CVE-2022-50459: scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()
In the Linux kernel, the following vulnerability has been resolved:
scsi: iscsi: iscsitcp: Fix null-ptr-deref while calling getpeername()
Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs.
The problem is that:
1. iscsiswtcpconngetparam() and iscsiswtcphostgetparam() take the frwdlock and do sockhold() then drop the frwdlock. sockhold() does a get on the "struct sock".
2. iscsiswtcpreleaseconn() does sockfdput() which does the last put on the "struct socket" and that does sockrelease() which sets the sock->ops to NULL.
3. iscsiswtcpconngetparam() and iscsiswtcphostgetparam() then call kernelgetpeername() which accesses the NULL sock->ops.
Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwdlock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsitcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwdlock.
Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2022-50459?
CVE-2022-50459 has a medium severity rating due to its potential to cause a system crash.
How do I fix CVE-2022-50459?
To fix CVE-2022-50459, upgrade to the latest version of the Linux kernel that includes the patch addressing this vulnerability.
What causes CVE-2022-50459?
CVE-2022-50459 is caused by a NULL pointer dereference when accessing the socket via sysfs while it is being freed.
Which versions of the Linux kernel are affected by CVE-2022-50459?
CVE-2022-50459 affects specific versions of the Linux kernel prior to the release of the fix.
Can CVE-2022-50459 be exploited remotely?
CVE-2022-50459 can potentially be exploited remotely under certain configurations, making it a significant security concern.