]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
authorMike Christie <michael.christie@oracle.com>
Tue, 17 Jan 2023 19:39:37 +0000 (13:39 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:12 +0000 (11:28 +0100)
commit6a4b90400b0f0d260e78540272d1684db190b545
treef9dc9c4cb7efbe600b507a0503114d2a1710df24
parentcea30b842ee5e31a3e70be5e19a8f8b0d71790d8
scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress

[ Upstream commit f484a794e4ee2a9ce61f52a78e810ac45f3fe3b3 ]

If during iscsi_sw_tcp_session_create() iscsi_tcp_r2tpool_alloc() fails,
userspace could be accessing the host's ipaddress attr. If we then free the
session via iscsi_session_teardown() while userspace is still accessing the
session we will hit a use after free bug.

Set the tcp_sw_host->session after we have completed session creation and
can no longer fail.

Link: https://lore.kernel.org/r/20230117193937.21244-3-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Acked-by: Ding Hui <dinghui@sangfor.com.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/iscsi_tcp.c