Subject: CVE-2024-27396: net: gtp: Fix Use-After-Free in gtp_dellink

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

net: gtp: Fix Use-After-Free in gtp_dellink

Since call_rcu, which is called in the hlist_for_each_entry_rcu traversal
of gtp_dellink, is not part of the RCU read critical section, it
is possible that the RCU grace period will pass during the traversal and
the key will be free.

To prevent this, it should be changed to hlist_for_each_entry_safe.

The Linux kernel CVE team has assigned CVE-2024-27396 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.19.93 with commit 043a283d24f4 and fixed in 4.19.313 with commit 07b20d0a3dc1
	Issue introduced in 5.4.8 with commit c185e1d6e275 and fixed in 5.4.275 with commit 718df1bc226c
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 5.10.216 with commit 0caff3e6390f
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 5.15.158 with commit 2e74b3fd6bf5
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 6.1.90 with commit 25a1c2d4b1fc
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 6.6.30 with commit 2aacd4de4547
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 6.8.9 with commit cd957d1716ec
	Issue introduced in 5.5 with commit 94dc550a5062 and fixed in 6.9 with commit f2a904107ee2
	Issue introduced in 4.14.162 with commit a29c4303930b

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-27396
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/07b20d0a3dc13fb1adff10b60021a4924498da58
	https://git.kernel.org/stable/c/718df1bc226c383dd803397d7f5d95557eb81ac7
	https://git.kernel.org/stable/c/0caff3e6390f840666b8dc1ecebf985c2ef3f1dd
	https://git.kernel.org/stable/c/2e74b3fd6bf542349758f283676dff3660327c07
	https://git.kernel.org/stable/c/25a1c2d4b1fcf938356a9688a96a6456abd44b29
	https://git.kernel.org/stable/c/2aacd4de45477582993f8a8abb9505a06426bfb6
	https://git.kernel.org/stable/c/cd957d1716ec979d8f5bf38fc659aeb9fdaa2474
	https://git.kernel.org/stable/c/f2a904107ee2b647bb7794a1a82b67740d7c8a64