]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ipv6: mcast: extend RCU protection in igmp6_send()
authorEric Dumazet <edumazet@google.com>
Fri, 7 Feb 2025 13:58:40 +0000 (13:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 13:01:43 +0000 (14:01 +0100)
commit0bf8e2f3768629d437a32cb824149e6e98254381
tree762c6410243eda74989097f8abcec18c8c4beace
parent789230e5a8c1097301afc802e242c79bc8835c67
ipv6: mcast: extend RCU protection in igmp6_send()

[ Upstream commit 087c1faa594fa07a66933d750c0b2610aa1a2946 ]

igmp6_send() can be called without RTNL or RCU being held.

Extend RCU protection so that we can safely fetch the net pointer
and avoid a potential UAF.

Note that we no longer can use sock_alloc_send_skb() because
ipv6.igmp_sk uses GFP_KERNEL allocations which can sleep.

Instead use alloc_skb() and charge the net->ipv6.igmp_sk
socket under RCU protection.

Fixes: b8ad0cbc58f7 ("[NETNS][IPV6] mcast - handle several network 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-9-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/mcast.c