Skip to content
Snippets Groups Projects
Commit a4191bb2 authored by Ming Lei's avatar Ming Lei Committed by Lee Jones
Browse files

scsi: core: Only put parent device if host state differs from SHOST_CREATED

commit 1e0d4e62 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: default avatarJohn Garry <john.garry@huawei.com>
Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I4f8e1e6fa48434efe93fa5e3f5c15ab6d7c097ce
parent 898e36a0
No related merge requests found
......@@ -337,7 +337,7 @@ static void scsi_host_dev_release(struct device *dev)
kfree(shost->shost_data);
if (parent)
if (shost->shost_state != SHOST_CREATED)
put_device(parent);
kfree(shost);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment