Mike Christie 6abd4698f4 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>
2023-02-22 12:47:12 +01:00
..
2021-07-20 16:16:08 +02:00
2021-07-20 16:16:08 +02:00
2018-08-21 23:54:17 -04:00
2017-12-04 20:32:53 -05:00
2018-06-19 22:02:25 -04:00
2018-06-19 22:02:25 -04:00
2018-05-18 12:03:51 -04:00
2018-06-19 22:02:25 -04:00
2018-06-19 22:02:25 -04:00
2023-01-18 11:30:22 +01:00
2019-12-01 09:16:26 +01:00
2021-05-22 10:59:33 +02:00
2018-08-15 22:06:26 -07:00
2018-06-12 16:19:22 -07:00
2017-11-14 16:23:44 -08:00
2018-08-15 22:06:26 -07:00
2018-06-10 13:01:12 -07:00
2018-06-19 22:02:25 -04:00
2018-08-15 22:06:26 -07:00
2021-05-22 10:59:34 +02:00
2022-01-27 09:04:30 +01:00
2022-01-27 09:04:30 +01:00
2021-05-22 10:59:34 +02:00
2018-05-01 23:30:12 -04:00