[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2024110834-CVE-2024-50186-acb0@gregkh>
Date: Fri, 8 Nov 2024 06:38:39 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-cve-announce@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: CVE-2024-50186: net: explicitly clear the sk pointer, when pf->create fails
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: explicitly clear the sk pointer, when pf->create fails
We have recently noticed the exact same KASAN splat as in commit
6cd4a78d962b ("net: do not leave a dangling sk pointer, when socket
creation fails"). The problem is that commit did not fully address the
problem, as some pf->create implementations do not use sk_common_release
in their error paths.
For example, we can use the same reproducer as in the above commit, but
changing ping to arping. arping uses AF_PACKET socket and if packet_create
fails, it will just sk_free the allocated sk object.
While we could chase all the pf->create implementations and make sure they
NULL the freed sk object on error from the socket, we can't guarantee
future protocols will not make the same mistake.
So it is easier to just explicitly NULL the sk pointer upon return from
pf->create in __sock_create. We do know that pf->create always releases the
allocated sk object on error, so if the pointer is not NULL, it is
definitely dangling.
The Linux kernel CVE team has assigned CVE-2024-50186 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.15.162 with commit 78e4aa528a7b and fixed in 5.15.168 with commit daf462ff3cde
Issue introduced in 6.1.96 with commit 893eeba94c40 and fixed in 6.1.113 with commit b7d22a79ff4e
Issue introduced in 6.6.36 with commit 454c454ed645 and fixed in 6.6.57 with commit 563e6892e21d
Issue introduced in 6.10 with commit 6cd4a78d962b and fixed in 6.11.4 with commit 8e1b72fd74bf
Issue introduced in 6.10 with commit 6cd4a78d962b and fixed in 6.12-rc3 with commit 631083143315
Issue introduced in 6.9.7 with commit 5dfe2408fd7d
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-2024-50186
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:
net/socket.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/daf462ff3cde6ecf22b98d9ae770232c10d28de2
https://git.kernel.org/stable/c/b7d22a79ff4e962b8af5ffe623abd1d6c179eb9f
https://git.kernel.org/stable/c/563e6892e21d6ecabdf62103fc4e7b326d212334
https://git.kernel.org/stable/c/8e1b72fd74bf9da3b099d09857f4e7f114f38e12
https://git.kernel.org/stable/c/631083143315d1b192bd7d915b967b37819e88ea
Powered by blists - more mailing lists