CVE-2023-52974: scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
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.
The Linux kernel CVE team has assigned CVE-2023-52974 to this issue.
Affected and fixed versions
===========================
Fixed in 4.14.306 with commit 496af9d3682ed4c28fb734342a09e6cc0c056ea4 Fixed in 4.19.273 with commit 6abd4698f4c8a78e7bbfc421205c060c199554a0 Fixed in 5.4.232 with commit d4d765f4761f9e3a2d62992f825aeee593bcb6b9 Fixed in 5.10.168 with commit 9758ffe1c07b86aefd7ca8e40d9a461293427ca0 Fixed in 5.15.93 with commit 0aaabdb900c7415caa2006ef580322f7eac5f6b6 Fixed in 6.1.11 with commit 61e43ebfd243bcbad11be26bd921723027b77441 Fixed in 6.2 with commit f484a794e4ee2a9ce61f52a78e810ac45f3fe3b3
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2023-52974
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/scsi/iscsi_tcp.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/496af9d3682ed4c28fb734342a09e6cc0c056ea4 https://git.kernel.org/stable/c/6abd4698f4c8a78e7bbfc421205c060c199554a0 https://git.kernel.org/stable/c/d4d765f4761f9e3a2d62992f825aeee593bcb6b9 https://git.kernel.org/stable/c/9758ffe1c07b86aefd7ca8e40d9a461293427ca0 https://git.kernel.org/stable/c/0aaabdb900c7415caa2006ef580322f7eac5f6b6 https://git.kernel.org/stable/c/61e43ebfd243bcbad11be26bd921723027b77441 https://git.kernel.org/stable/c/f484a794e4ee2a9ce61f52a78e810ac45f3fe3b3