mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
scsi: iscsi: Fix inappropriate use of put_device()
[ Upstream commit6dc1c7ab6f
] 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:f3c893e3db
("scsi: iscsi: Fail session and connection on transport registration failure") Reported-by: Hulk Robot <hulkci@huawei.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f6d844be95
commit
dcda662622
1 changed files with 3 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue