Re: [PATCH 1/4] scsi: core: fix error handling of scsi_host_alloc
From: John Garry <hidden>
Date: 2021-06-03 15:40:27
From: John Garry <hidden>
Date: 2021-06-03 15:40:27
On 02/06/2021 14:30, Ming Lei wrote:
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(). Fixes the issue by replacing kfree(shost) via put_device(&shost->shost_gendev) which can help to free dev_name(&shost->shost_dev) when host state is in SHOST_CREATED. Meantime needn't to remove IDA and stop the kthread of shost->ehandler in the error handling code. Cc: Bart Van Assche<bvanassche@acm.org> Cc: John Garry<redacted> Cc: Hannes Reinecke<hare@suse.de> Signed-off-by: Ming Lei<redacted>
Reviewed-by: John Garry <redacted>