]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: libiscsi: Teardown iscsi_cls_conn gracefully
authorWenchao Hao <haowenchao@huawei.com>
Thu, 10 Mar 2022 01:57:59 +0000 (20:57 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 15 Mar 2022 04:20:16 +0000 (00:20 -0400)
commit558a323a0e148396db0219171535b5e56bd80399
treec6b33d2807e849584d32de862a6ca432380444a5
parentd8446604fb0a7a83d685d6bb25f4407a5a458116
scsi: libiscsi: Teardown iscsi_cls_conn gracefully

Commit 0e49b49181bc ("scsi: libiscsi: Fix UAF in
iscsi_conn_get_param()/iscsi_conn_teardown()") fixed an UAF in
iscsi_conn_get_param() and introduced 2 tmp_xxx varibles.

We can gracefully fix this UAF with the help of device_del(). Calling
iscsi_remove_conn() at the beginning of iscsi_conn_teardown would make
userspace unable to see iscsi_cls_conn. This way we we can free memory
safely.

Remove iscsi_destroy_conn() since it is no longer used.

Link: https://lore.kernel.org/r/20220310015759.3296841-4-haowenchao@huawei.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
Signed-off-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libiscsi.c
drivers/scsi/scsi_transport_iscsi.c
include/scsi/scsi_transport_iscsi.h