CVE-2024-56602: net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
sock_init_data() attaches the allocated sk object to the provided sock object. If ieee802154_create() fails later, the allocated sk object is freed, but the dangling pointer remains in the provided sock object, which may allow use-after-free.
Clear the sk pointer in the sock object on error.
The Linux kernel CVE team has assigned CVE-2024-56602 to this issue.
Affected and fixed versions
===========================
Fixed in 5.4.287 with commit 1d5fe782c0ff068d80933f9cfd0fd39d5434bbc9 Fixed in 5.10.231 with commit 14959fd7538b3be6d7617d9e60e404d6a8d4fd1f Fixed in 5.15.174 with commit 2b46994a6e76c8cc5556772932b9b60d03a55cd8 Fixed in 6.1.120 with commit e8bd6c5f5dc2234b4ea714380aedeea12a781754 Fixed in 6.6.66 with commit b4982fbf13042e3bb33e04eddfea8b1506b5ea65 Fixed in 6.12.5 with commit 03caa9bfb9fde97fb53d33decd7364514e6825cb Fixed in 6.13-rc1 with commit b4fcd63f6ef79c73cafae8cf4a114def5fc3d80d
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-56602
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/ieee802154/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/1d5fe782c0ff068d80933f9cfd0fd39d5434bbc9 https://git.kernel.org/stable/c/14959fd7538b3be6d7617d9e60e404d6a8d4fd1f https://git.kernel.org/stable/c/2b46994a6e76c8cc5556772932b9b60d03a55cd8 https://git.kernel.org/stable/c/e8bd6c5f5dc2234b4ea714380aedeea12a781754 https://git.kernel.org/stable/c/b4982fbf13042e3bb33e04eddfea8b1506b5ea65 https://git.kernel.org/stable/c/03caa9bfb9fde97fb53d33decd7364514e6825cb https://git.kernel.org/stable/c/b4fcd63f6ef79c73cafae8cf4a114def5fc3d80d