diff options
author | Ming Lei <ming.lei@redhat.com> | 2021-06-02 21:30:26 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-07 22:12:44 -0400 |
commit | 66a834d092930cf41d809c0e989b13cd6f9ca006 (patch) | |
tree | 887ea2cfbda60d34674863452f8a0050a3f8f2ab /net/ipv6/ip6mr.c | |
parent | e57f5cd99ca60cddf40201b0f4ced9f1938e299c (diff) |
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>
Diffstat (limited to 'net/ipv6/ip6mr.c')
0 files changed, 0 insertions, 0 deletions