Commit 45b012dd authored by Eric Dumazet's avatar Eric Dumazet Committed by sanglipeng
Browse files

igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU

stable inclusion
from stable-v5.10.195
commit 1186eaffd87ed9be6f18cbc7145ffdcb1f6982e0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I95JOC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1186eaffd87ed9be6f18cbc7145ffdcb1f6982e0

--------------------------------

commit c3b704d4 upstream.

This is a follow up of commit 915d975b ("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: 57e1ab6e ("igmp: refine skb allocations")
Link: https://lore.kernel.org/netdev/d273628df80f45428e739274ab9ecb72@AcuMS.aculab.com/


Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarDavid Laight <David.Laight@ACULAB.COM>
Cc: Kyle Zeng <zengyhkyle@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 18f640c4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment