From: Greg Kroah-Hartman Date: Mon, 25 Apr 2022 10:23:44 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.9.312~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=841aad2feedbe05b1c974a951a80bf4a054502a5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch --- diff --git a/queue-4.19/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch b/queue-4.19/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch new file mode 100644 index 00000000000..ebe5981e7bb --- /dev/null +++ b/queue-4.19/ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch @@ -0,0 +1,40 @@ +From aafa9f958342db36c17ac2a7f1b841032c96feb4 Mon Sep 17 00:00:00 2001 +From: Zheyu Ma +Date: Thu, 21 Apr 2022 09:39:20 +0800 +Subject: ata: pata_marvell: Check the 'bmdma_addr' beforing reading + +From: Zheyu Ma + +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] +[ 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 +Signed-off-by: Damien Le Moal +Signed-off-by: Greg Kroah-Hartman +--- + 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.19/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch b/queue-4.19/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch new file mode 100644 index 00000000000..25b5d4de86a --- /dev/null +++ b/queue-4.19/dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch @@ -0,0 +1,57 @@ +From 206680c4e46b62fd8909385e0874a36952595b85 Mon Sep 17 00:00:00 2001 +From: Xiaomeng Tong +Date: Sun, 27 Mar 2022 14:11:54 +0800 +Subject: dma: at_xdmac: fix a missing check on list iterator + +From: Xiaomeng Tong + +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 +Link: https://lore.kernel.org/r/20220327061154.4867-1-xiam0nd.tong@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -1390,7 +1390,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; +@@ -1505,11 +1505,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; + diff --git a/queue-4.19/series b/queue-4.19/series index 56ef477284d..9ee0d7feed8 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -26,3 +26,5 @@ dpaa_eth-fix-missing-of_node_put-in-dpaa_get_ts_info.patch drm-msm-mdp5-check-the-return-of-kzalloc.patch net-macb-restart-tx-only-if-queue-pointer-is-lagging.patch stat-fix-inconsistency-between-struct-stat-and-struc.patch +ata-pata_marvell-check-the-bmdma_addr-beforing-reading.patch +dma-at_xdmac-fix-a-missing-check-on-list-iterator.patch