]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Sep 2024 12:53:38 +0000 (14:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Sep 2024 12:53:38 +0000 (14:53 +0200)
added patches:
fs-ntfs3-use-kvfree-to-free-memory-allocated-by-kvmalloc.patch
net-xilinx-axienet-fix-race-in-axienet_stop.patch
pmdomain-ti-add-a-null-pointer-check-to-the-omap_prm_domain_init.patch

queue-6.1/fs-ntfs3-use-kvfree-to-free-memory-allocated-by-kvmalloc.patch [new file with mode: 0644]
queue-6.1/net-xilinx-axienet-fix-race-in-axienet_stop.patch [new file with mode: 0644]
queue-6.1/pmdomain-ti-add-a-null-pointer-check-to-the-omap_prm_domain_init.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/fs-ntfs3-use-kvfree-to-free-memory-allocated-by-kvmalloc.patch b/queue-6.1/fs-ntfs3-use-kvfree-to-free-memory-allocated-by-kvmalloc.patch
new file mode 100644 (file)
index 0000000..846bacb
--- /dev/null
@@ -0,0 +1,89 @@
+From ddb17dc880eeaac37b5a6e984de07b882de7d78d Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Tue, 16 Jan 2024 10:32:20 +0300
+Subject: fs/ntfs3: Use kvfree to free memory allocated by kvmalloc
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit ddb17dc880eeaac37b5a6e984de07b882de7d78d upstream.
+
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/attrlist.c |    4 ++--
+ fs/ntfs3/bitmap.c   |    4 ++--
+ fs/ntfs3/frecord.c  |    4 ++--
+ fs/ntfs3/super.c    |    2 +-
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/fs/ntfs3/attrlist.c
++++ b/fs/ntfs3/attrlist.c
+@@ -29,7 +29,7 @@ static inline bool al_is_valid_le(const
+ void al_destroy(struct ntfs_inode *ni)
+ {
+       run_close(&ni->attr_list.run);
+-      kfree(ni->attr_list.le);
++      kvfree(ni->attr_list.le);
+       ni->attr_list.le = NULL;
+       ni->attr_list.size = 0;
+       ni->attr_list.dirty = false;
+@@ -318,7 +318,7 @@ int al_add_le(struct ntfs_inode *ni, enu
+               memcpy(ptr, al->le, off);
+               memcpy(Add2Ptr(ptr, off + sz), le, old_size - off);
+               le = Add2Ptr(ptr, off);
+-              kfree(al->le);
++              kvfree(al->le);
+               al->le = ptr;
+       } else {
+               memmove(Add2Ptr(le, sz), le, old_size - off);
+--- a/fs/ntfs3/bitmap.c
++++ b/fs/ntfs3/bitmap.c
+@@ -124,7 +124,7 @@ void wnd_close(struct wnd_bitmap *wnd)
+ {
+       struct rb_node *node, *next;
+-      kfree(wnd->free_bits);
++      kvfree(wnd->free_bits);
+       run_close(&wnd->run);
+       node = rb_first(&wnd->start_tree);
+@@ -1333,7 +1333,7 @@ int wnd_extend(struct wnd_bitmap *wnd, s
+               memcpy(new_free, wnd->free_bits, wnd->nwnd * sizeof(short));
+               memset(new_free + wnd->nwnd, 0,
+                      (new_wnd - wnd->nwnd) * sizeof(short));
+-              kfree(wnd->free_bits);
++              kvfree(wnd->free_bits);
+               wnd->free_bits = new_free;
+       }
+--- a/fs/ntfs3/frecord.c
++++ b/fs/ntfs3/frecord.c
+@@ -773,7 +773,7 @@ static int ni_try_remove_attr_list(struc
+       run_deallocate(sbi, &ni->attr_list.run, true);
+       run_close(&ni->attr_list.run);
+       ni->attr_list.size = 0;
+-      kfree(ni->attr_list.le);
++      kvfree(ni->attr_list.le);
+       ni->attr_list.le = NULL;
+       ni->attr_list.dirty = false;
+@@ -924,7 +924,7 @@ int ni_create_attr_list(struct ntfs_inod
+       goto out;
+ out1:
+-      kfree(ni->attr_list.le);
++      kvfree(ni->attr_list.le);
+       ni->attr_list.le = NULL;
+       ni->attr_list.size = 0;
+       return err;
+--- a/fs/ntfs3/super.c
++++ b/fs/ntfs3/super.c
+@@ -441,7 +441,7 @@ static noinline void put_ntfs(struct ntf
+ {
+       kfree(sbi->new_rec);
+       kvfree(ntfs_put_shared(sbi->upcase));
+-      kfree(sbi->def_table);
++      kvfree(sbi->def_table);
+       wnd_close(&sbi->mft.bitmap);
+       wnd_close(&sbi->used.bitmap);
diff --git a/queue-6.1/net-xilinx-axienet-fix-race-in-axienet_stop.patch b/queue-6.1/net-xilinx-axienet-fix-race-in-axienet_stop.patch
new file mode 100644 (file)
index 0000000..7b5b70f
--- /dev/null
@@ -0,0 +1,91 @@
+From 858430db28a5f5a11f8faa3a6fa805438e6f0851 Mon Sep 17 00:00:00 2001
+From: Sean Anderson <sean.anderson@linux.dev>
+Date: Tue, 3 Sep 2024 13:51:41 -0400
+Subject: net: xilinx: axienet: Fix race in axienet_stop
+
+From: Sean Anderson <sean.anderson@linux.dev>
+
+commit 858430db28a5f5a11f8faa3a6fa805438e6f0851 upstream.
+
+axienet_dma_err_handler can race with axienet_stop in the following
+manner:
+
+CPU 1                       CPU 2
+======================      ==================
+axienet_stop()
+    napi_disable()
+    axienet_dma_stop()
+                            axienet_dma_err_handler()
+                                napi_disable()
+                                axienet_dma_stop()
+                                axienet_dma_start()
+                                napi_enable()
+    cancel_work_sync()
+    free_irq()
+
+Fix this by setting a flag in axienet_stop telling
+axienet_dma_err_handler not to bother doing anything. I chose not to use
+disable_work_sync to allow for easier backporting.
+
+Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
+Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")
+Link: https://patch.msgid.link/20240903175141.4132898-1-sean.anderson@linux.dev
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+[ Adjusted to apply before dmaengine support ]
+Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/xilinx/xilinx_axienet.h      |    3 +++
+ drivers/net/ethernet/xilinx/xilinx_axienet_main.c |    8 ++++++++
+ 2 files changed, 11 insertions(+)
+
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
+@@ -419,6 +419,8 @@ struct axidma_bd {
+  * @tx_bytes: TX byte count for statistics
+  * @tx_stat_sync: Synchronization object for TX stats
+  * @dma_err_task: Work structure to process Axi DMA errors
++ * @stopping:   Set when @dma_err_task shouldn't do anything because we are
++ *              about to stop the device.
+  * @tx_irq:   Axidma TX IRQ number
+  * @rx_irq:   Axidma RX IRQ number
+  * @eth_irq:  Ethernet core IRQ number
+@@ -481,6 +483,7 @@ struct axienet_local {
+       struct u64_stats_sync tx_stat_sync;
+       struct work_struct dma_err_task;
++      bool stopping;
+       int tx_irq;
+       int rx_irq;
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+@@ -1161,6 +1161,7 @@ static int axienet_open(struct net_devic
+       phylink_start(lp->phylink);
+       /* Enable worker thread for Axi DMA error handling */
++      lp->stopping = false;
+       INIT_WORK(&lp->dma_err_task, axienet_dma_err_handler);
+       napi_enable(&lp->napi_rx);
+@@ -1216,6 +1217,9 @@ static int axienet_stop(struct net_devic
+       dev_dbg(&ndev->dev, "axienet_close()\n");
++      WRITE_ONCE(lp->stopping, true);
++      flush_work(&lp->dma_err_task);
++
+       napi_disable(&lp->napi_tx);
+       napi_disable(&lp->napi_rx);
+@@ -1760,6 +1764,10 @@ static void axienet_dma_err_handler(stru
+                                               dma_err_task);
+       struct net_device *ndev = lp->ndev;
++      /* Don't bother if we are going to stop anyway */
++      if (READ_ONCE(lp->stopping))
++              return;
++
+       napi_disable(&lp->napi_tx);
+       napi_disable(&lp->napi_rx);
diff --git a/queue-6.1/pmdomain-ti-add-a-null-pointer-check-to-the-omap_prm_domain_init.patch b/queue-6.1/pmdomain-ti-add-a-null-pointer-check-to-the-omap_prm_domain_init.patch
new file mode 100644 (file)
index 0000000..97486b6
--- /dev/null
@@ -0,0 +1,34 @@
+From 5d7f58ee08434a33340f75ac7ac5071eea9673b3 Mon Sep 17 00:00:00 2001
+From: Kunwu Chan <chentao@kylinos.cn>
+Date: Thu, 18 Jan 2024 13:42:57 +0800
+Subject: pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
+
+From: Kunwu Chan <chentao@kylinos.cn>
+
+commit 5d7f58ee08434a33340f75ac7ac5071eea9673b3 upstream.
+
+devm_kasprintf() returns a pointer to dynamically allocated memory
+which can be NULL upon failure. Ensure the allocation was successful
+by checking the pointer validity.
+
+Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
+Link: https://lore.kernel.org/r/20240118054257.200814-1-chentao@kylinos.cn
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+[Xiangyu: Modified to apply on 6.1.y]
+Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/soc/ti/omap_prm.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/soc/ti/omap_prm.c
++++ b/drivers/soc/ti/omap_prm.c
+@@ -696,6 +696,8 @@ static int omap_prm_domain_init(struct d
+       data = prm->data;
+       name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
+                             data->name);
++      if (!name)
++              return -ENOMEM;
+       prmd->dev = dev;
+       prmd->prm = prm;
index 15c3d1b8a43baa54de22f8c54884ec8cbc6ba493..d8b35b65c1f94243932038b44fb47d605dce9c34 100644 (file)
@@ -27,3 +27,6 @@ minmax-reduce-min-max-macro-expansion-in-atomisp-driver.patch
 net-tighten-bad-gso-csum-offset-check-in-virtio_net_hdr.patch
 dm-integrity-fix-a-race-condition-when-accessing-recalc_sector.patch
 mm-avoid-leaving-partial-pfn-mappings-around-in-error-case.patch
+net-xilinx-axienet-fix-race-in-axienet_stop.patch
+pmdomain-ti-add-a-null-pointer-check-to-the-omap_prm_domain_init.patch
+fs-ntfs3-use-kvfree-to-free-memory-allocated-by-kvmalloc.patch