]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Apr 2024 12:43:58 +0000 (14:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Apr 2024 12:43:58 +0000 (14:43 +0200)
added patches:
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

queue-4.19/mtd-diskonchip-work-around-ubsan-link-failure.patch [new file with mode: 0644]
queue-4.19/net-b44-set-pause-params-only-when-interface-is-up.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch [new file with mode: 0644]
queue-4.19/wifi-nl80211-don-t-free-null-coalescing-rule.patch [new file with mode: 0644]

diff --git a/queue-4.19/mtd-diskonchip-work-around-ubsan-link-failure.patch b/queue-4.19/mtd-diskonchip-work-around-ubsan-link-failure.patch
new file mode 100644 (file)
index 0000000..35132cb
--- /dev/null
@@ -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
+@@ -52,7 +52,7 @@ static unsigned long doc_locations[] __i
+       0xe8000, 0xea000, 0xec000, 0xee000,
+ #endif
+ #endif
+-      0xffffffff };
++};
+ static struct mtd_info *doclist = NULL;
+@@ -1678,7 +1678,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-4.19/net-b44-set-pause-params-only-when-interface-is-up.patch b/queue-4.19/net-b44-set-pause-params-only-when-interface-is-up.patch
new file mode 100644 (file)
index 0000000..17879b0
--- /dev/null
@@ -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
+@@ -2033,12 +2033,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);
index 1a337c0a149cb712e2ba172eb17c6594a9c9fb6a..3fb5b755d8f75742837b8f0d34f3a0c64c31ad1e 100644 (file)
@@ -62,3 +62,7 @@ bluetooth-fix-type-of-len-in-l2cap-sco-_sock_getsockopt_old.patch
 btrfs-fix-information-leak-in-btrfs_ioctl_logical_to_ino.patch
 arm64-dts-rockchip-enable-internal-pull-up-for-q7_thrm-on-rk3399-puma.patch
 irqchip-gic-v3-its-prevent-double-free-on-error.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-4.19/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch b/queue-4.19/stackdepot-respect-__gfp_nolockdep-allocation-flag.patch
new file mode 100644 (file)
index 0000000..87219d1
--- /dev/null
@@ -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
+@@ -256,10 +256,10 @@ depot_stack_handle_t depot_save_stack(st
+               /*
+                * 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-4.19/wifi-nl80211-don-t-free-null-coalescing-rule.patch b/queue-4.19/wifi-nl80211-don-t-free-null-coalescing-rule.patch
new file mode 100644 (file)
index 0000000..22db85e
--- /dev/null
@@ -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
+@@ -11492,6 +11492,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);