This is a note to let you know that I've just added the patch titled igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c3b704d4a4a265660e665df51b129e8425216ed1 Mon Sep 17 00:00:00 2001 From: Eric Dumazet <edumazet@xxxxxxxxxx> Date: Tue, 5 Sep 2023 04:23:38 +0000 Subject: igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU From: Eric Dumazet <edumazet@xxxxxxxxxx> commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream. This is a follow up of commit 915d975b2ffa ("net: deal with integer overflows in kmalloc_reserve()") based on David Laight feedback. Back in 2010, I failed to realize malicious users could set dev->mtu to arbitrary values. This mtu has been since limited to 0x7fffffff but regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack() to allocate more than IP_MAX_MTU and risk various skb fields overflows. Fixes: 57e1ab6eaddc ("igmp: refine skb allocations") Link: https://lore.kernel.org/netdev/d273628df80f45428e739274ab9ecb72@xxxxxxxxxxxxxxxx/ Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Reported-by: David Laight <David.Laight@xxxxxxxxxx> Cc: Kyle Zeng <zengyhkyle@xxxxxxxxx> Reviewed-by: Simon Horman <horms@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/ipv4/igmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -353,8 +353,9 @@ static struct sk_buff *igmpv3_newpack(st struct flowi4 fl4; int hlen = LL_RESERVED_SPACE(dev); int tlen = dev->needed_tailroom; - unsigned int size = mtu; + unsigned int size; + size = min(mtu, IP_MAX_MTU); while (1) { skb = alloc_skb(size + hlen + tlen, GFP_ATOMIC | __GFP_NOWARN); Patches currently in stable-queue which might be from edumazet@xxxxxxxxxx are queue-6.1/igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch queue-6.1/net-annotate-data-races-around-sk-sk_-rcv-snd-timeo.patch queue-6.1/tcp-tcp_enter_quickack_mode-should-be-static.patch queue-6.1/net-tcp-fix-unexcepted-socket-die-when-snd_wnd-is-0.patch queue-6.1/net-annotate-data-races-around-sk-sk_lingertime.patch