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@xxxxxxx> Cc: John Garry<john.garry@xxxxxxxxxx> Cc: Hannes Reinecke<hare@xxxxxxx> Signed-off-by: Ming Lei<ming.lei@xxxxxxxxxx>
Reviewed-by: John Garry <john.garry@xxxxxxxxxx>