aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-29 14:44:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-29 14:44:36 +0200
commiteca91319207fc1fd180bbf3bd54a3132f38c8d60 (patch)
tree3d375a7b64d9c3f1b37609692723a9b9be3f7b60
parentf169e044b92b0303c2f1603f502e1be25c29b44c (diff)
downloadstable-queue-eca91319207fc1fd180bbf3bd54a3132f38c8d60.tar.gz
5.15-stable patches
added patches: ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch mtd-diskonchip-work-around-ubsan-link-failure.patch net-b44-set-pause-params-only-when-interface-is-up.patch stackdepot-respect-__gfp_nolockdep-allocation-flag.patch wifi-nl80211-don-t-free-null-coalescing-rule.patch
-rw-r--r--queue-5.15/ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch78
-rw-r--r--queue-5.15/mtd-diskonchip-work-around-ubsan-link-failure.patch56
-rw-r--r--queue-5.15/net-b44-set-pause-params-only-when-interface-is-up.patch61
-rw-r--r--queue-5.15/series5
-rw-r--r--queue-5.15/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch95
-rw-r--r--queue-5.15/wifi-nl80211-don-t-free-null-coalescing-rule.patch32
6 files changed, 327 insertions, 0 deletions
diff --git a/queue-5.15/ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch b/queue-5.15/ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch
new file mode 100644
index 0000000000..a2948bb32c
--- /dev/null
+++ b/queue-5.15/ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch
@@ -0,0 +1,78 @@
+From 6e159fd653d7ebf6290358e0330a0cb8a75cf73b Mon Sep 17 00:00:00 2001
+From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
+Date: Tue, 23 Apr 2024 11:13:03 -0700
+Subject: ethernet: Add helper for assigning packet type when dest address does not match device address
+
+From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
+
+commit 6e159fd653d7ebf6290358e0330a0cb8a75cf73b upstream.
+
+Enable reuse of logic in eth_type_trans for determining packet type.
+
+Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
+Cc: stable@vger.kernel.org
+Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
+Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
+Link: https://lore.kernel.org/r/20240423181319.115860-3-rrameshbabu@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/etherdevice.h | 25 +++++++++++++++++++++++++
+ net/ethernet/eth.c | 12 +-----------
+ 2 files changed, 26 insertions(+), 11 deletions(-)
+
+--- a/include/linux/etherdevice.h
++++ b/include/linux/etherdevice.h
+@@ -543,6 +543,31 @@ static inline unsigned long compare_ethe
+ }
+
+ /**
++ * eth_skb_pkt_type - Assign packet type if destination address does not match
++ * @skb: Assigned a packet type if address does not match @dev address
++ * @dev: Network device used to compare packet address against
++ *
++ * If the destination MAC address of the packet does not match the network
++ * device address, assign an appropriate packet type.
++ */
++static inline void eth_skb_pkt_type(struct sk_buff *skb,
++ const struct net_device *dev)
++{
++ const struct ethhdr *eth = eth_hdr(skb);
++
++ if (unlikely(!ether_addr_equal_64bits(eth->h_dest, dev->dev_addr))) {
++ if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
++ if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
++ skb->pkt_type = PACKET_BROADCAST;
++ else
++ skb->pkt_type = PACKET_MULTICAST;
++ } else {
++ skb->pkt_type = PACKET_OTHERHOST;
++ }
++ }
++}
++
++/**
+ * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame
+ * @skb: Buffer to pad
+ *
+--- a/net/ethernet/eth.c
++++ b/net/ethernet/eth.c
+@@ -163,17 +163,7 @@ __be16 eth_type_trans(struct sk_buff *sk
+ eth = (struct ethhdr *)skb->data;
+ skb_pull_inline(skb, ETH_HLEN);
+
+- if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
+- dev->dev_addr))) {
+- if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
+- if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
+- skb->pkt_type = PACKET_BROADCAST;
+- else
+- skb->pkt_type = PACKET_MULTICAST;
+- } else {
+- skb->pkt_type = PACKET_OTHERHOST;
+- }
+- }
++ eth_skb_pkt_type(skb, dev);
+
+ /*
+ * Some variants of DSA tagging don't have an ethertype field
diff --git a/queue-5.15/mtd-diskonchip-work-around-ubsan-link-failure.patch b/queue-5.15/mtd-diskonchip-work-around-ubsan-link-failure.patch
new file mode 100644
index 0000000000..b86272b6e8
--- /dev/null
+++ b/queue-5.15/mtd-diskonchip-work-around-ubsan-link-failure.patch
@@ -0,0 +1,56 @@
+From 21c9fb611c25d5cd038f6fe485232e7884bb0b3d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 5 Apr 2024 16:30:04 +0200
+Subject: mtd: diskonchip: work around ubsan link failure
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 21c9fb611c25d5cd038f6fe485232e7884bb0b3d upstream.
+
+I ran into a randconfig build failure with UBSAN using gcc-13.2:
+
+arm-linux-gnueabi-ld: error: unplaced orphan section `.bss..Lubsan_data31' from `drivers/mtd/nand/raw/diskonchip.o'
+
+I'm not entirely sure what is going on here, but I suspect this has something
+to do with the check for the end of the doc_locations[] array that contains
+an (unsigned long)0xffffffff element, which is compared against the signed
+(int)0xffffffff. If this is the case, we should get a runtime check for
+undefined behavior, but we instead get an unexpected build-time error.
+
+I would have expected this to work fine on 32-bit architectures despite the
+signed integer overflow, though on 64-bit architectures this likely won't
+ever work.
+
+Changing the contition to instead check for the size of the array makes the
+code safe everywhere and avoids the ubsan check that leads to the link
+error. The loop code goes back to before 2.6.12.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20240405143015.717429-1-arnd@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/diskonchip.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/raw/diskonchip.c
++++ b/drivers/mtd/nand/raw/diskonchip.c
+@@ -53,7 +53,7 @@ static unsigned long doc_locations[] __i
+ 0xe8000, 0xea000, 0xec000, 0xee000,
+ #endif
+ #endif
+- 0xffffffff };
++};
+
+ static struct mtd_info *doclist = NULL;
+
+@@ -1552,7 +1552,7 @@ static int __init init_nanddoc(void)
+ if (ret < 0)
+ return ret;
+ } else {
+- for (i = 0; (doc_locations[i] != 0xffffffff); i++) {
++ for (i = 0; i < ARRAY_SIZE(doc_locations); i++) {
+ doc_probe(doc_locations[i]);
+ }
+ }
diff --git a/queue-5.15/net-b44-set-pause-params-only-when-interface-is-up.patch b/queue-5.15/net-b44-set-pause-params-only-when-interface-is-up.patch
new file mode 100644
index 0000000000..a2624772cf
--- /dev/null
+++ b/queue-5.15/net-b44-set-pause-params-only-when-interface-is-up.patch
@@ -0,0 +1,61 @@
+From e3eb7dd47bd4806f00e104eb6da092c435f9fb21 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Peter=20M=C3=BCnster?= <pm@a16n.net>
+Date: Wed, 24 Apr 2024 15:51:52 +0200
+Subject: net: b44: set pause params only when interface is up
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Peter Münster <pm@a16n.net>
+
+commit e3eb7dd47bd4806f00e104eb6da092c435f9fb21 upstream.
+
+b44_free_rings() accesses b44::rx_buffers (and ::tx_buffers)
+unconditionally, but b44::rx_buffers is only valid when the
+device is up (they get allocated in b44_open(), and deallocated
+again in b44_close()), any other time these are just a NULL pointers.
+
+So if you try to change the pause params while the network interface
+is disabled/administratively down, everything explodes (which likely
+netifd tries to do).
+
+Link: https://github.com/openwrt/openwrt/issues/13789
+Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
+Cc: stable@vger.kernel.org
+Reported-by: Peter Münster <pm@a16n.net>
+Suggested-by: Jonas Gorski <jonas.gorski@gmail.com>
+Signed-off-by: Vaclav Svoboda <svoboda@neng.cz>
+Tested-by: Peter Münster <pm@a16n.net>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Peter Münster <pm@a16n.net>
+Reviewed-by: Michael Chan <michael.chan@broadcom.com>
+Link: https://lore.kernel.org/r/87y192oolj.fsf@a16n.net
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/broadcom/b44.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -2029,12 +2029,14 @@ static int b44_set_pauseparam(struct net
+ bp->flags |= B44_FLAG_TX_PAUSE;
+ else
+ bp->flags &= ~B44_FLAG_TX_PAUSE;
+- if (bp->flags & B44_FLAG_PAUSE_AUTO) {
+- b44_halt(bp);
+- b44_init_rings(bp);
+- b44_init_hw(bp, B44_FULL_RESET);
+- } else {
+- __b44_set_flow_ctrl(bp, bp->flags);
++ if (netif_running(dev)) {
++ if (bp->flags & B44_FLAG_PAUSE_AUTO) {
++ b44_halt(bp);
++ b44_init_rings(bp);
++ b44_init_hw(bp, B44_FULL_RESET);
++ } else {
++ __b44_set_flow_ctrl(bp, bp->flags);
++ }
+ }
+ spin_unlock_irq(&bp->lock);
+
diff --git a/queue-5.15/series b/queue-5.15/series
index 4d109f6a6d..b5b1899b03 100644
--- a/queue-5.15/series
+++ b/queue-5.15/series
@@ -60,3 +60,8 @@ arm64-dts-rockchip-enable-internal-pull-up-for-q7_thrm-on-rk3399-puma.patch
drm-amdgpu-sdma5.2-use-legacy-hdp-flush-for-sdma2-3.patch
drm-amdgpu-fix-leak-when-gpu-memory-allocation-fails.patch
irqchip-gic-v3-its-prevent-double-free-on-error.patch
+ethernet-add-helper-for-assigning-packet-type-when-dest-address-does-not-match-device-address.patch
+net-b44-set-pause-params-only-when-interface-is-up.patch
+stackdepot-respect-__gfp_nolockdep-allocation-flag.patch
+wifi-nl80211-don-t-free-null-coalescing-rule.patch
+mtd-diskonchip-work-around-ubsan-link-failure.patch
diff --git a/queue-5.15/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch b/queue-5.15/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch
new file mode 100644
index 0000000000..b63e3f86d1
--- /dev/null
+++ b/queue-5.15/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch
@@ -0,0 +1,95 @@
+From 6fe60465e1d53ea321ee909be26d97529e8f746c Mon Sep 17 00:00:00 2001
+From: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+Date: Thu, 18 Apr 2024 16:11:33 +0200
+Subject: stackdepot: respect __GFP_NOLOCKDEP allocation flag
+
+From: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+
+commit 6fe60465e1d53ea321ee909be26d97529e8f746c upstream.
+
+If stack_depot_save_flags() allocates memory it always drops
+__GFP_NOLOCKDEP flag. So when KASAN tries to track __GFP_NOLOCKDEP
+allocation we may end up with lockdep splat like bellow:
+
+======================================================
+ WARNING: possible circular locking dependency detected
+ 6.9.0-rc3+ #49 Not tainted
+ ------------------------------------------------------
+ kswapd0/149 is trying to acquire lock:
+ ffff88811346a920
+(&xfs_nondir_ilock_class){++++}-{4:4}, at: xfs_reclaim_inode+0x3ac/0x590
+[xfs]
+
+ but task is already holding lock:
+ ffffffff8bb33100 (fs_reclaim){+.+.}-{0:0}, at:
+balance_pgdat+0x5d9/0xad0
+
+ which lock already depends on the new lock.
+
+ the existing dependency chain (in reverse order) is:
+ -> #1 (fs_reclaim){+.+.}-{0:0}:
+ __lock_acquire+0x7da/0x1030
+ lock_acquire+0x15d/0x400
+ fs_reclaim_acquire+0xb5/0x100
+ prepare_alloc_pages.constprop.0+0xc5/0x230
+ __alloc_pages+0x12a/0x3f0
+ alloc_pages_mpol+0x175/0x340
+ stack_depot_save_flags+0x4c5/0x510
+ kasan_save_stack+0x30/0x40
+ kasan_save_track+0x10/0x30
+ __kasan_slab_alloc+0x83/0x90
+ kmem_cache_alloc+0x15e/0x4a0
+ __alloc_object+0x35/0x370
+ __create_object+0x22/0x90
+ __kmalloc_node_track_caller+0x477/0x5b0
+ krealloc+0x5f/0x110
+ xfs_iext_insert_raw+0x4b2/0x6e0 [xfs]
+ xfs_iext_insert+0x2e/0x130 [xfs]
+ xfs_iread_bmbt_block+0x1a9/0x4d0 [xfs]
+ xfs_btree_visit_block+0xfb/0x290 [xfs]
+ xfs_btree_visit_blocks+0x215/0x2c0 [xfs]
+ xfs_iread_extents+0x1a2/0x2e0 [xfs]
+ xfs_buffered_write_iomap_begin+0x376/0x10a0 [xfs]
+ iomap_iter+0x1d1/0x2d0
+ iomap_file_buffered_write+0x120/0x1a0
+ xfs_file_buffered_write+0x128/0x4b0 [xfs]
+ vfs_write+0x675/0x890
+ ksys_write+0xc3/0x160
+ do_syscall_64+0x94/0x170
+ entry_SYSCALL_64_after_hwframe+0x71/0x79
+
+Always preserve __GFP_NOLOCKDEP to fix this.
+
+Link: https://lkml.kernel.org/r/20240418141133.22950-1-ryabinin.a.a@gmail.com
+Fixes: cd11016e5f52 ("mm, kasan: stackdepot implementation. Enable stackdepot for SLAB")
+Signed-off-by: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+Reported-by: Xiubo Li <xiubli@redhat.com>
+Closes: https://lore.kernel.org/all/a0caa289-ca02-48eb-9bf2-d86fd47b71f4@redhat.com/
+Reported-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Closes: https://lore.kernel.org/all/f9ff999a-e170-b66b-7caf-293f2b147ac2@opensource.wdc.com/
+Suggested-by: Dave Chinner <david@fromorbit.com>
+Tested-by: Xiubo Li <xiubli@redhat.com>
+Cc: Christoph Hellwig <hch@infradead.org>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/stackdepot.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/lib/stackdepot.c
++++ b/lib/stackdepot.c
+@@ -294,10 +294,10 @@ depot_stack_handle_t stack_depot_save(un
+ /*
+ * Zero out zone modifiers, as we don't have specific zone
+ * requirements. Keep the flags related to allocation in atomic
+- * contexts and I/O.
++ * contexts, I/O, nolockdep.
+ */
+ alloc_flags &= ~GFP_ZONEMASK;
+- alloc_flags &= (GFP_ATOMIC | GFP_KERNEL);
++ alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | __GFP_NOLOCKDEP);
+ alloc_flags |= __GFP_NOWARN;
+ page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER);
+ if (page)
diff --git a/queue-5.15/wifi-nl80211-don-t-free-null-coalescing-rule.patch b/queue-5.15/wifi-nl80211-don-t-free-null-coalescing-rule.patch
new file mode 100644
index 0000000000..3da8220444
--- /dev/null
+++ b/queue-5.15/wifi-nl80211-don-t-free-null-coalescing-rule.patch
@@ -0,0 +1,32 @@
+From 801ea33ae82d6a9d954074fbcf8ea9d18f1543a7 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Thu, 18 Apr 2024 10:52:23 +0200
+Subject: wifi: nl80211: don't free NULL coalescing rule
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 801ea33ae82d6a9d954074fbcf8ea9d18f1543a7 upstream.
+
+If the parsing fails, we can dereference a NULL pointer here.
+
+Cc: stable@vger.kernel.org
+Fixes: be29b99a9b51 ("cfg80211/nl80211: Add packet coalesce support")
+Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240418105220.b328f80406e7.Id75d961050deb05b3e4e354e024866f350c68103@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/wireless/nl80211.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -12890,6 +12890,8 @@ static int nl80211_set_coalesce(struct s
+ error:
+ for (i = 0; i < new_coalesce.n_rules; i++) {
+ tmp_rule = &new_coalesce.rules[i];
++ if (!tmp_rule)
++ continue;
+ for (j = 0; j < tmp_rule->n_patterns; j++)
+ kfree(tmp_rule->patterns[j].mask);
+ kfree(tmp_rule->patterns);