]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Sep 2023 11:45:28 +0000 (12:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Sep 2023 11:45:28 +0000 (12:45 +0100)
added patches:
igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch
netfilter-ipset-add-the-missing-ip_set_hash_with_net0-macro-for-ip_set_hash_netportnet.c.patch

queue-5.10/igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch [new file with mode: 0644]
queue-5.10/netfilter-ipset-add-the-missing-ip_set_hash_with_net0-macro-for-ip_set_hash_netportnet.c.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch b/queue-5.10/igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch
new file mode 100644 (file)
index 0000000..363f125
--- /dev/null
@@ -0,0 +1,42 @@
+From c3b704d4a4a265660e665df51b129e8425216ed1 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet@google.com>
+Date: Tue, 5 Sep 2023 04:23:38 +0000
+Subject: igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
+
+From: Eric Dumazet <edumazet@google.com>
+
+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@AcuMS.aculab.com/
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: David Laight <David.Laight@ACULAB.COM>
+Cc: Kyle Zeng <zengyhkyle@gmail.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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);
diff --git a/queue-5.10/netfilter-ipset-add-the-missing-ip_set_hash_with_net0-macro-for-ip_set_hash_netportnet.c.patch b/queue-5.10/netfilter-ipset-add-the-missing-ip_set_hash_with_net0-macro-for-ip_set_hash_netportnet.c.patch
new file mode 100644 (file)
index 0000000..6ae2622
--- /dev/null
@@ -0,0 +1,36 @@
+From 050d91c03b28ca479df13dfb02bcd2c60dd6a878 Mon Sep 17 00:00:00 2001
+From: Kyle Zeng <zengyhkyle@gmail.com>
+Date: Tue, 5 Sep 2023 15:04:09 -0700
+Subject: netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
+
+From: Kyle Zeng <zengyhkyle@gmail.com>
+
+commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
+
+The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can
+lead to the use of wrong `CIDR_POS(c)` for calculating array offsets,
+which can lead to integer underflow. As a result, it leads to slab
+out-of-bound access.
+This patch adds back the IP_SET_HASH_WITH_NET0 macro to
+ip_set_hash_netportnet to address the issue.
+
+Fixes: 886503f34d63 ("netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net")
+Suggested-by: Jozsef Kadlecsik <kadlec@netfilter.org>
+Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com>
+Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/netfilter/ipset/ip_set_hash_netportnet.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/netfilter/ipset/ip_set_hash_netportnet.c
++++ b/net/netfilter/ipset/ip_set_hash_netportnet.c
+@@ -35,6 +35,7 @@ MODULE_ALIAS("ip_set_hash:net,port,net")
+ #define IP_SET_HASH_WITH_PROTO
+ #define IP_SET_HASH_WITH_NETS
+ #define IPSET_NET_COUNT 2
++#define IP_SET_HASH_WITH_NET0
+ /* IPv4 variant */
index 309e3303874160f26b1ed690bf61c65b9644b543..068f72a3308ac97c195f4a501069623fcd632856 100644 (file)
@@ -267,3 +267,5 @@ um-fix-hostaudio-build-errors.patch
 dmaengine-ste_dma40-add-missing-irq-check-in-d40_pro.patch
 cpufreq-fix-the-race-condition-while-updating-the-tr.patch
 virtio_ring-fix-avail_wrap_counter-in-virtqueue_add_.patch
+igmp-limit-igmpv3_newpack-packet-size-to-ip_max_mtu.patch
+netfilter-ipset-add-the-missing-ip_set_hash_with_net0-macro-for-ip_set_hash_netportnet.c.patch