]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Apr 2022 10:19:56 +0000 (12:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Apr 2022 10:19:56 +0000 (12:19 +0200)
added patches:
ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch
dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch

queue-4.9/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch [new file with mode: 0644]
queue-4.9/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch b/queue-4.9/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch
new file mode 100644 (file)
index 0000000..ebe5981
--- /dev/null
@@ -0,0 +1,40 @@
+From aafa9f958342db36c17ac2a7f1b841032c96feb4 Mon Sep 17 00:00:00 2001
+From: Zheyu Ma <zheyuma97@gmail.com>
+Date: Thu, 21 Apr 2022 09:39:20 +0800
+Subject: ata: pata_marvell: Check the 'bmdma_addr' beforing reading
+
+From: Zheyu Ma <zheyuma97@gmail.com>
+
+commit aafa9f958342db36c17ac2a7f1b841032c96feb4 upstream.
+
+Before detecting the cable type on the dma bar, the driver should check
+whether the 'bmdma_addr' is zero, which means the adapter does not
+support DMA, otherwise we will get the following error:
+
+[    5.146634] Bad IO access at port 0x1 (return inb(port))
+[    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
+[    5.150856] RIP: 0010:ioread8+0x4a/0x60
+[    5.160238] Call Trace:
+[    5.160470]  <TASK>
+[    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
+[    5.161728]  ata_eh_recover+0x3520/0x6cc0
+[    5.168075]  ata_do_eh+0x49/0x3c0
+
+Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
+Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/pata_marvell.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/ata/pata_marvell.c
++++ b/drivers/ata/pata_marvell.c
+@@ -82,6 +82,8 @@ static int marvell_cable_detect(struct a
+       switch(ap->port_no)
+       {
+       case 0:
++              if (!ap->ioaddr.bmdma_addr)
++                      return ATA_CBL_PATA_UNK;
+               if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
+                       return ATA_CBL_PATA40;
+               return ATA_CBL_PATA80;
diff --git a/queue-4.9/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch b/queue-4.9/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch
new file mode 100644 (file)
index 0000000..d41a8d7
--- /dev/null
@@ -0,0 +1,57 @@
+From 206680c4e46b62fd8909385e0874a36952595b85 Mon Sep 17 00:00:00 2001
+From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
+Date: Sun, 27 Mar 2022 14:11:54 +0800
+Subject: dma: at_xdmac: fix a missing check on list iterator
+
+From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
+
+commit 206680c4e46b62fd8909385e0874a36952595b85 upstream.
+
+The bug is here:
+       __func__, desc, &desc->tx_dma_desc.phys, ret, cookie, residue);
+
+The list iterator 'desc' will point to a bogus position containing
+HEAD if the list is empty or no element is found. To avoid dev_dbg()
+prints a invalid address, use a new variable 'iter' as the list
+iterator, while use the origin variable 'desc' as a dedicated
+pointer to point to the found element.
+
+Cc: stable@vger.kernel.org
+Fixes: 82e2424635f4c ("dmaengine: xdmac: fix print warning on dma_addr_t variable")
+Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
+Link: https://lore.kernel.org/r/20220327061154.4867-1-xiam0nd.tong@gmail.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/at_xdmac.c |   12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -1392,7 +1392,7 @@ at_xdmac_tx_status(struct dma_chan *chan
+ {
+       struct at_xdmac_chan    *atchan = to_at_xdmac_chan(chan);
+       struct at_xdmac         *atxdmac = to_at_xdmac(atchan->chan.device);
+-      struct at_xdmac_desc    *desc, *_desc;
++      struct at_xdmac_desc    *desc, *_desc, *iter;
+       struct list_head        *descs_list;
+       enum dma_status         ret;
+       int                     residue, retry;
+@@ -1507,11 +1507,13 @@ at_xdmac_tx_status(struct dma_chan *chan
+        * microblock.
+        */
+       descs_list = &desc->descs_list;
+-      list_for_each_entry_safe(desc, _desc, descs_list, desc_node) {
+-              dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg);
+-              residue -= (desc->lld.mbr_ubc & 0xffffff) << dwidth;
+-              if ((desc->lld.mbr_nda & 0xfffffffc) == cur_nda)
++      list_for_each_entry_safe(iter, _desc, descs_list, desc_node) {
++              dwidth = at_xdmac_get_dwidth(iter->lld.mbr_cfg);
++              residue -= (iter->lld.mbr_ubc & 0xffffff) << dwidth;
++              if ((iter->lld.mbr_nda & 0xfffffffc) == cur_nda) {
++                      desc = iter;
+                       break;
++              }
+       }
+       residue += cur_ubc << dwidth;
index bec207f896eb3e4b5607e3d560d77a419c9ef62a..3ff0370b520cf7735ad1410dfda34ab974fc501c 100644 (file)
@@ -12,3 +12,5 @@ vxlan-fix-error-return-code-in-vxlan_fdb_append.patch
 cifs-check-the-iocb_direct-flag-not-o_direct.patch
 brcmfmac-sdio-fix-undefined-behavior-due-to-shift-ov.patch
 drm-msm-mdp5-check-the-return-of-kzalloc.patch
+ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch
+dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch