]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Mar 2023 07:29:27 +0000 (08:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Mar 2023 07:29:27 +0000 (08:29 +0100)
added patches:
brd-use-radix_tree_maybe_preload-instead-of-radix_tree_preload.patch
qede-avoid-uninitialized-entries-in-coal_entry-array.patch

queue-6.1/brd-use-radix_tree_maybe_preload-instead-of-radix_tree_preload.patch [new file with mode: 0644]
queue-6.1/qede-avoid-uninitialized-entries-in-coal_entry-array.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/brd-use-radix_tree_maybe_preload-instead-of-radix_tree_preload.patch b/queue-6.1/brd-use-radix_tree_maybe_preload-instead-of-radix_tree_preload.patch
new file mode 100644 (file)
index 0000000..ebb0e79
--- /dev/null
@@ -0,0 +1,47 @@
+From 0aa2988e4fd23c0c8b33999d7b47dfbc5e6bf24b Mon Sep 17 00:00:00 2001
+From: Pankaj Raghav <p.raghav@samsung.com>
+Date: Fri, 17 Feb 2023 17:44:44 +0530
+Subject: brd: use radix_tree_maybe_preload instead of radix_tree_preload
+
+From: Pankaj Raghav <p.raghav@samsung.com>
+
+commit 0aa2988e4fd23c0c8b33999d7b47dfbc5e6bf24b upstream.
+
+Unconditionally calling radix_tree_preload_end() results in a OOPS
+message as the preload is only conditionally called for
+gfpflags_allow_blocking().
+
+[   20.267323] BUG: using smp_processor_id() in preemptible [00000000] code: fio/416
+[   20.267837] caller is brd_insert_page.part.0+0xbe/0x190 [brd]
+[   20.269436] Call Trace:
+[   20.269598]  <TASK>
+[   20.269742]  dump_stack_lvl+0x32/0x50
+[   20.269982]  check_preemption_disabled+0xd1/0xe0
+[   20.270289]  brd_insert_page.part.0+0xbe/0x190 [brd]
+[   20.270664]  brd_submit_bio+0x33f/0xf40 [brd]
+
+Use radix_tree_maybe_preload() which does preload only if
+gfpflags_allow_blocking() is true but also takes the lock. Therefore,
+unconditionally calling radix_tree_preload_end() should not create any
+issues and the message disappears.
+
+Fixes: 6ded703c56c2 ("brd: check for REQ_NOWAIT and set correct page allocation mask")
+Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
+Link: https://lore.kernel.org/r/20230217121442.33914-1-p.raghav@samsung.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/brd.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/block/brd.c
++++ b/drivers/block/brd.c
+@@ -94,7 +94,7 @@ static int brd_insert_page(struct brd_de
+       if (!page)
+               return -ENOMEM;
+-      if (gfpflags_allow_blocking(gfp) && radix_tree_preload(gfp)) {
++      if (radix_tree_maybe_preload(gfp)) {
+               __free_page(page);
+               return -ENOMEM;
+       }
diff --git a/queue-6.1/qede-avoid-uninitialized-entries-in-coal_entry-array.patch b/queue-6.1/qede-avoid-uninitialized-entries-in-coal_entry-array.patch
new file mode 100644 (file)
index 0000000..dd7c5cb
--- /dev/null
@@ -0,0 +1,77 @@
+From aaa3c08ee0653beaa649d4adfb27ad562641cfd8 Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt@redhat.com>
+Date: Fri, 24 Feb 2023 01:41:45 +0100
+Subject: qede: avoid uninitialized entries in coal_entry array
+
+From: Michal Schmidt <mschmidt@redhat.com>
+
+commit aaa3c08ee0653beaa649d4adfb27ad562641cfd8 upstream.
+
+Even after commit 908d4bb7c54c ("qede: fix interrupt coalescing
+configuration"), some entries of the coal_entry array may theoretically
+be used uninitialized:
+
+ 1. qede_alloc_fp_array() allocates QEDE_MAX_RSS_CNT entries for
+    coal_entry. The initial allocation uses kcalloc, so everything is
+    initialized.
+ 2. The user sets a small number of queues (ethtool -L).
+    coal_entry is reallocated for the actual small number of queues.
+ 3. The user sets a bigger number of queues.
+    coal_entry is reallocated bigger. The added entries are not
+    necessarily initialized.
+
+In practice, the reallocations will actually keep using the originally
+allocated region of memory, but we should not rely on it.
+
+The reallocation is unnecessary. coal_entry can always have
+QEDE_MAX_RSS_CNT entries.
+
+Fixes: 908d4bb7c54c ("qede: fix interrupt coalescing configuration")
+Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
+Nacked-by: Manish Chopra <manishc@marvell.com>
+Acked-by: Manish Chopra <manishc@marvell.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/qlogic/qede/qede_main.c |   21 +++++++--------------
+ 1 file changed, 7 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
+@@ -960,7 +960,6 @@ static int qede_alloc_fp_array(struct qe
+ {
+       u8 fp_combined, fp_rx = edev->fp_num_rx;
+       struct qede_fastpath *fp;
+-      void *mem;
+       int i;
+       edev->fp_array = kcalloc(QEDE_QUEUE_CNT(edev),
+@@ -971,21 +970,15 @@ static int qede_alloc_fp_array(struct qe
+       }
+       if (!edev->coal_entry) {
+-              mem = kcalloc(QEDE_MAX_RSS_CNT(edev),
+-                            sizeof(*edev->coal_entry), GFP_KERNEL);
+-      } else {
+-              mem = krealloc(edev->coal_entry,
+-                             QEDE_QUEUE_CNT(edev) * sizeof(*edev->coal_entry),
+-                             GFP_KERNEL);
++              edev->coal_entry = kcalloc(QEDE_MAX_RSS_CNT(edev),
++                                         sizeof(*edev->coal_entry),
++                                         GFP_KERNEL);
++              if (!edev->coal_entry) {
++                      DP_ERR(edev, "coalesce entry allocation failed\n");
++                      goto err;
++              }
+       }
+-      if (!mem) {
+-              DP_ERR(edev, "coalesce entry allocation failed\n");
+-              kfree(edev->coal_entry);
+-              goto err;
+-      }
+-      edev->coal_entry = mem;
+-
+       fp_combined = QEDE_QUEUE_CNT(edev) - fp_rx - edev->fp_num_tx;
+       /* Allocate the FP elements for Rx queues followed by combined and then
index ca0c282b8421832dfe00207f509eb6725f6504f3..d15610f4f4ac21fbaee950697438de572510fc0a 100644 (file)
@@ -882,3 +882,5 @@ drm-i915-don-t-use-bar-mappings-for-ring-buffers-with-llc.patch
 drm-gud-fix-ubsan-warning.patch
 drm-edid-fix-avi-infoframe-aspect-ratio-handling.patch
 drm-edid-fix-parsing-of-3d-modes-from-hdmi-vsdb.patch
+qede-avoid-uninitialized-entries-in-coal_entry-array.patch
+brd-use-radix_tree_maybe_preload-instead-of-radix_tree_preload.patch