Ming Lei
db08ce595d
scsi: core: Fix error handling of scsi_host_alloc()
...
commit 66a834d092930cf41d809c0e989b13cd6f9ca006 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-16 11:53:04 +02:00
..
2020-10-01 13:12:37 +02:00
2020-02-28 16:36:01 +01:00
2019-02-12 19:46:13 +01:00
2020-08-21 09:48:08 +02:00
2020-12-29 13:46:44 +01:00
2020-01-14 20:05:46 +01:00
2021-03-03 18:22:50 +01:00
2020-12-29 13:46:47 +01:00
2020-10-29 09:07:04 +01:00
2020-01-17 19:45:53 +01:00
2019-02-12 19:46:12 +01:00
2021-05-22 10:57:19 +02:00
2020-01-23 08:20:36 +01:00
2020-09-03 11:22:27 +02:00
2020-12-29 13:47:00 +01:00
2020-06-11 09:22:55 +02:00
2021-02-07 14:47:41 +01:00
2018-10-20 09:48:50 +02:00
2019-12-01 09:13:29 +01:00
2021-05-22 10:57:20 +02:00
2021-06-03 08:36:25 +02:00
2021-05-22 10:57:20 +02:00
2020-02-14 16:32:23 -05:00
2021-03-30 14:40:12 +02:00
2018-05-25 16:17:50 +02:00
2018-01-02 20:31:05 +01:00
2017-11-02 11:10:55 +01:00
2020-12-29 13:46:59 +01:00
2020-01-09 10:17:58 +01:00
2021-03-30 14:40:12 +02:00
2021-06-16 11:53:01 +02:00
2020-10-29 09:07:04 +01:00
2019-06-25 11:36:53 +08:00
2017-11-02 11:10:55 +01:00
2019-11-20 17:59:54 +01:00
2021-01-30 13:31:13 +01:00
2018-09-19 22:43:42 +02:00
2018-09-19 22:43:42 +02:00
2018-09-19 22:43:42 +02:00
2019-03-13 14:03:15 -07:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:10 -04:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:10 -04:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-08-24 22:29:07 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-01-04 13:59:44 +01:00
2017-11-02 11:10:55 +01:00
2021-06-03 08:36:22 +02:00
2021-06-03 08:36:22 +02:00
2019-10-29 09:17:32 +01:00
2017-11-02 11:10:55 +01:00
2019-12-01 09:13:34 +01:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:12 -04:00
2018-11-13 11:14:56 -08:00
2018-11-13 11:14:56 -08:00
2017-08-25 17:21:10 -04:00
2017-08-25 17:21:10 -04:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-09-09 19:03:12 +02:00
2017-08-25 17:21:10 -04:00
2017-11-02 11:10:55 +01:00
2021-06-16 11:53:04 +02:00
2019-07-10 09:54:35 +02:00
2020-11-18 18:27:55 +01:00
2018-08-15 18:12:47 +02:00
2017-08-25 17:21:10 -04:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2020-04-02 16:34:27 +02:00
2020-04-02 16:34:27 +02:00
2019-12-01 09:13:27 +01:00
2020-06-25 15:41:56 +02:00
2020-02-28 16:36:04 +01:00
2021-05-22 10:57:31 +02:00
2019-11-10 11:25:11 +01:00
2017-08-22 16:34:36 +02:00
2021-03-17 16:34:31 +01:00
2017-11-02 11:10:55 +01:00
2018-11-13 11:14:56 -08:00
2020-01-04 13:59:44 +01:00
2017-11-02 11:10:55 +01:00
2019-10-29 09:16:53 +01:00
2017-11-02 11:10:55 +01:00
2020-08-21 09:48:10 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-29 09:07:16 +01:00
2020-01-04 13:59:48 +01:00
2019-11-20 18:00:48 +01:00
2017-11-02 11:10:55 +01:00
2017-09-01 11:59:17 +02:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-24 22:29:01 -04:00
2017-11-02 11:10:55 +01:00
2017-08-24 22:29:05 -04:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:11 -04:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:21:11 -04:00
2017-08-28 22:15:46 -04:00
2017-11-02 11:10:55 +01:00
2019-05-16 19:42:27 +02:00
2017-11-02 11:10:55 +01:00
2020-08-21 09:48:09 +02:00
2017-12-20 10:10:20 +01:00
2020-06-30 15:37:57 -04:00
2019-05-08 07:20:49 +02:00
2019-10-29 09:17:31 +01:00
2017-08-25 17:08:07 -04:00
2017-11-02 11:10:55 +01:00
2020-12-29 13:46:53 +01:00
2019-10-07 18:55:06 +02:00
2017-11-02 11:10:55 +01:00
2019-01-23 08:09:48 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-11-10 10:29:05 +01:00
2019-10-29 09:17:32 +01:00
2020-01-23 08:20:37 +01:00
2017-11-02 11:10:55 +01:00
2017-10-11 14:33:12 -04:00
2021-03-07 11:27:45 +01:00
2017-08-29 21:51:45 -04:00
2020-07-29 07:42:51 +02:00
2021-04-28 12:08:40 +02:00
2017-09-07 12:12:43 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-07-25 11:25:06 +02:00
2020-04-02 16:34:30 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:51 +01:00
2020-05-20 08:17:06 +02:00
2017-08-25 17:21:10 -04:00
2021-05-22 10:57:31 +02:00
2018-05-30 07:51:49 +02:00
2017-11-02 11:10:55 +01:00
2020-06-25 15:41:50 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-04-07 12:47:01 +02:00
2017-11-02 11:10:55 +01:00
2019-05-08 07:20:50 +02:00
2020-01-04 13:59:44 +01:00
2021-05-22 10:57:31 +02:00
2019-03-23 14:35:20 +01:00
2021-06-16 11:53:01 +02:00
2017-08-25 17:21:10 -04:00
2017-11-02 11:10:55 +01:00
2018-08-24 13:09:01 +02:00
2017-08-22 16:34:36 +02:00