提交 46b53482 编写于 作者: Q Qinglang Miao 提交者: Xie XiuQi

scsi: iscsi: Fix inappropriate use of put_device()

stable inclusion
from stable-5.10.4
commit dcda662622b17adaec14a1a6d82bf09e87b9ce11
bugzilla: 46903

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

[ Upstream commit 6dc1c7ab ]

kfree(conn) is called inside put_device(&conn->dev) which could lead to
use-after-free. In addition, device_unregister() should be used here rather
than put_deviceO().

Link: https://lore.kernel.org/r/20201120074852.31658-1-miaoqinglang@huawei.com
Fixes: f3c893e3 ("scsi: iscsi: Fail session and connection on transport registration failure")
Reported-by: NHulk Robot <hulkci@huawei.com>
Reviewed-by: NMike Christie <michael.christie@oracle.com>
Signed-off-by: NQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 d8d8396a
......@@ -2313,7 +2313,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid)
return conn;
release_conn_ref:
put_device(&conn->dev);
device_unregister(&conn->dev);
put_device(&session->dev);
return NULL;
release_parent_ref:
put_device(&session->dev);
free_conn:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部