On 6/2/21 3:30 PM, 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> > --- > drivers/scsi/hosts.c | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, 90409 Nürnberg GF: F. Imendörffer, HRB 36809 (AG Nürnberg)