提交 9e7a87f1 编写于 作者: M Ming Lei 提交者: Wang ShaoBo

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

stable inclusion
from stable-v5.10.44
commit 5b537408f2733d510060e72596befa44c3435cb6
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=403
CVE: NA

-------------------------------------------------

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: NJohn Garry <john.garry@huawei.com>
Reviewed-by: NJohn Garry <john.garry@huawei.com>
Signed-off-by: NMing Lei <ming.lei@redhat.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nyangshuo <look4polaris@163.com>
Reviewed-by: NJian Cheng <cj.chengjian@huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 39348e58
...@@ -343,7 +343,7 @@ static void scsi_host_dev_release(struct device *dev) ...@@ -343,7 +343,7 @@ static void scsi_host_dev_release(struct device *dev)
ida_simple_remove(&host_index_ida, shost->host_no); ida_simple_remove(&host_index_ida, shost->host_no);
if (parent) if (shost->shost_state != SHOST_CREATED)
put_device(parent); put_device(parent);
kfree(shost); kfree(shost);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册