Files
linux/drivers/scsi
Ming Lei 66a834d092 scsi: core: Fix error handling of scsi_host_alloc()
After device is initialized via device_initialize(), or its name is set via
dev_set_name(), the device has to be freed via put_device().  Otherwise
device name will be leaked because it is allocated dynamically in
dev_set_name().

Fix the leak by replacing kfree() with put_device(). Since
scsi_host_dev_release() properly handles IDA and kthread removal, remove
special-casing these from the error handling as well.

Link: https://lore.kernel.org/r/20210602133029.2864069-2-ming.lei@redhat.com
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Hannes Reinecke <hare@suse.de>
Tested-by: John Garry <john.garry@huawei.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-06-07 22:12:44 -04:00
..
2021-01-22 21:14:09 -05:00
2021-03-24 22:54:24 -04:00
2020-03-11 23:07:59 -04:00
2021-04-15 22:44:40 -04:00
2021-01-22 21:14:07 -05:00
2021-01-22 21:14:08 -05:00
2021-01-22 21:14:07 -05:00
2021-04-06 09:28:17 -06:00
2021-01-22 21:14:08 -05:00
2020-03-11 23:07:59 -04:00
2021-03-24 23:07:14 -04:00
2020-09-02 22:49:06 -04:00
2020-08-23 17:36:59 -05:00
2021-04-13 00:20:48 -04:00
2021-04-06 09:28:17 -06:00
2020-12-07 20:24:09 -05:00
2021-01-22 21:14:07 -05:00
2021-04-15 22:44:40 -04:00
2021-04-15 22:44:41 -04:00
2021-01-26 22:11:17 -05:00
2020-12-07 20:24:09 -05:00
2020-12-07 20:24:09 -05:00
2020-08-23 17:36:59 -05:00
2021-03-24 23:03:43 -04:00
2020-02-24 15:01:57 -05:00
2021-04-06 09:28:17 -06:00
2021-04-06 09:28:17 -06:00
2021-01-22 21:14:10 -05:00
2021-04-13 00:20:48 -04:00
2021-01-22 21:14:12 -05:00