scsi: core: Only put parent device if host state differs from SHOST_CREATED
authorMing Lei <ming.lei@redhat.com>
Wed, 2 Jun 2021 13:30:29 +0000 (21:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jun 2021 09:53:04 +0000 (11:53 +0200)
commit07cc88bc484c4e4e5ce3b7b2f22a65f776da4b72
treef2c3c5d7695d3bd8806c6a076c907acf1f96ffba
parentc5711c21f9d2e6284d8f75f860a7df3c4cc9d9fe
scsi: core: Only put parent device if host state differs from SHOST_CREATED

commit 1e0d4e6225996f05271de1ebcb1a7c9381af0b27 upstream.

get_device(shost->shost_gendev.parent) is called after host state has
switched to SHOST_RUNNING. scsi_host_dev_release() shouldn't release the
parent device if host state is still SHOST_CREATED.

Link: https://lore.kernel.org/r/20210602133029.2864069-5-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: John Garry <john.garry@huawei.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/hosts.c