]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ndisc: extend RCU protection in ndisc_send_skb()
authorEric Dumazet <edumazet@google.com>
Fri, 7 Feb 2025 13:58:39 +0000 (13:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 13:01:43 +0000 (14:01 +0100)
commit789230e5a8c1097301afc802e242c79bc8835c67
tree93c3083d131f419ed3ecf0cda40cedacc24bf263
parenta849a10de5e04d798f7f286a2f1ca174719a617a
ndisc: extend RCU protection in ndisc_send_skb()

[ Upstream commit ed6ae1f325d3c43966ec1b62ac1459e2b8e45640 ]

ndisc_send_skb() can be called without RTNL or RCU held.

Acquire rcu_read_lock() earlier, so that we can use dev_net_rcu()
and avoid a potential UAF.

Fixes: 1762f7e88eb3 ("[NETNS][IPV6] ndisc - make socket control per namespace")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250207135841.1948589-8-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/ndisc.c