scsi: core: Put .shost_dev in failure path if host state changes to RUNNING
scsi_host_dev_release() only frees dev_name when host state is SHOST_CREATED. After host state has changed to SHOST_RUNNING, scsi_host_dev_release() no longer cleans up. Fix this by doing a put_device(&shost->shost_dev) in the failure path when host state is SHOST_RUNNING. Move get_device(&shost->shost_gendev) before device_add(&shost->shost_dev) so that scsi_host_cls_release() can do a put on this reference. Link: https://lore.kernel.org/r/20210602133029.2864069-4-ming.lei@redhat.com Cc: Bart Van Assche <bvanassche@acm.org> Cc: Hannes Reinecke <hare@suse.de> Reported-by: NJohn Garry <john.garry@huawei.com> Tested-by: NJohn Garry <john.garry@huawei.com> Reviewed-by: NJohn Garry <john.garry@huawei.com> Reviewed-by: NHannes Reinecke <hare@suse.de> Signed-off-by: NMing Lei <ming.lei@redhat.com> Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Showing
想要评论请 注册 或 登录