CVE-2024-46677: gtp: fix a potential NULL pointer dereference
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
gtp: fix a potential NULL pointer dereference
When sockfd_lookup() fails, gtp_encap_enable_socket() returns a NULL pointer, but its callers only check for error pointers thus miss the NULL pointer case.
Fix it by returning an error pointer with the error code carried from sockfd_lookup().
(I found this bug during code inspection.)
The Linux kernel CVE team has assigned CVE-2024-46677 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 4.19.321 with commit 620fe9809752 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 5.4.283 with commit bdd99e5f0ad5 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 5.10.225 with commit 8bbb9e4e0e66 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 5.15.166 with commit 4643b91691e9 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 6.1.108 with commit e8b9930b0eb0 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 6.6.49 with commit 28c67f0f84f8 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 6.10.8 with commit 612edd35f2a3 Issue introduced in 4.12 with commit 1e3a3abd8b28 and fixed in 6.11-rc6 with commit defd8b3c37b0
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-46677
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/net/gtp.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/620fe9809752fae91b4190e897b81ed9976dfb39 https://git.kernel.org/stable/c/bdd99e5f0ad5fa727b16f2101fe880aa2bff2f8e https://git.kernel.org/stable/c/8bbb9e4e0e66a39282e582d0440724055404b38c https://git.kernel.org/stable/c/4643b91691e969b1b9ad54bf552d7a990cfa3b87 https://git.kernel.org/stable/c/e8b9930b0eb045d19e883c65ff9676fc89320c70 https://git.kernel.org/stable/c/28c67f0f84f889fe9f4cbda8354132b20dc9212d https://git.kernel.org/stable/c/612edd35f2a3910ab1f61c1f2338889d4ba99fa2 https://git.kernel.org/stable/c/defd8b3c37b0f9cb3e0f60f47d3d78d459d57fda