]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: gtp: Fix Use-After-Free in gtp_dellink
authorHyunwoo Kim <v4bel@theori.io>
Mon, 22 Apr 2024 09:39:30 +0000 (05:39 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2024 14:32:36 +0000 (16:32 +0200)
commit2aacd4de45477582993f8a8abb9505a06426bfb6
tree2920eeab0b56bf26a4a0bb683863eb1df786c222
parent209967f5f06e76ee0536eea1aedade11036eed01
net: gtp: Fix Use-After-Free in gtp_dellink

[ Upstream commit f2a904107ee2b647bb7794a1a82b67740d7c8a64 ]

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.

Fixes: 94dc550a5062 ("gtp: fix an use-after-free in ipv4_pdp_find()")
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/gtp.c