]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.7-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jun 2020 14:29:40 +0000 (16:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jun 2020 14:29:40 +0000 (16:29 +0200)
added patches:
block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch
spi-spi-fsl-dspi-free-dma-memory-with-matching-function.patch

queue-5.7/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch [new file with mode: 0644]
queue-5.7/spi-spi-fsl-dspi-free-dma-memory-with-matching-function.patch [new file with mode: 0644]

diff --git a/queue-5.7/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch b/queue-5.7/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch
new file mode 100644 (file)
index 0000000..a429275
--- /dev/null
@@ -0,0 +1,37 @@
+From a75ca9303175d36af93c0937dd9b1a6422908b8d Mon Sep 17 00:00:00 2001
+From: yu kuai <yukuai3@huawei.com>
+Date: Mon, 1 Jun 2020 20:38:56 +0800
+Subject: block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed
+
+From: yu kuai <yukuai3@huawei.com>
+
+commit a75ca9303175d36af93c0937dd9b1a6422908b8d upstream.
+
+commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") added
+a kfree() for 'buf' if bio_integrity_add_page() returns '0'. However,
+the object will be freed in bio_integrity_free() since 'bio->bi_opf' and
+'bio->bi_integrity' were set previousy in bio_integrity_alloc().
+
+Fixes: commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug")
+Signed-off-by: yu kuai <yukuai3@huawei.com>
+Reviewed-by: Ming Lei <ming.lei@redhat.com>
+Reviewed-by: Bob Liu <bob.liu@oracle.com>
+Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ block/bio-integrity.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/block/bio-integrity.c
++++ b/block/bio-integrity.c
+@@ -278,7 +278,6 @@ bool bio_integrity_prep(struct bio *bio)
+               if (ret == 0) {
+                       printk(KERN_ERR "could not attach integrity payload\n");
+-                      kfree(buf);
+                       status = BLK_STS_RESOURCE;
+                       goto err_end_io;
+               }
diff --git a/queue-5.7/spi-spi-fsl-dspi-free-dma-memory-with-matching-function.patch b/queue-5.7/spi-spi-fsl-dspi-free-dma-memory-with-matching-function.patch
new file mode 100644 (file)
index 0000000..3a4c25f
--- /dev/null
@@ -0,0 +1,70 @@
+From 03fe7aaf0c3d40ef7feff2bdc7180c146989586a Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzk@kernel.org>
+Date: Wed, 10 Jun 2020 17:41:57 +0200
+Subject: spi: spi-fsl-dspi: Free DMA memory with matching function
+
+From: Krzysztof Kozlowski <krzk@kernel.org>
+
+commit 03fe7aaf0c3d40ef7feff2bdc7180c146989586a upstream.
+
+Driver allocates DMA memory with dma_alloc_coherent() but frees it with
+dma_unmap_single().
+
+This causes DMA warning during system shutdown (with DMA debugging) on
+Toradex Colibri VF50 module:
+
+    WARNING: CPU: 0 PID: 1 at ../kernel/dma/debug.c:1036 check_unmap+0x3fc/0xb04
+    DMA-API: fsl-edma 40098000.dma-controller: device driver frees DMA memory with wrong function
+      [device address=0x0000000087040000] [size=8 bytes] [mapped as coherent] [unmapped as single]
+    Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
+      (unwind_backtrace) from [<8010bb34>] (show_stack+0x10/0x14)
+      (show_stack) from [<8011ced8>] (__warn+0xf0/0x108)
+      (__warn) from [<8011cf64>] (warn_slowpath_fmt+0x74/0xb8)
+      (warn_slowpath_fmt) from [<8017d170>] (check_unmap+0x3fc/0xb04)
+      (check_unmap) from [<8017d900>] (debug_dma_unmap_page+0x88/0x90)
+      (debug_dma_unmap_page) from [<80601d68>] (dspi_release_dma+0x88/0x110)
+      (dspi_release_dma) from [<80601e4c>] (dspi_shutdown+0x5c/0x80)
+      (dspi_shutdown) from [<805845f8>] (device_shutdown+0x17c/0x220)
+      (device_shutdown) from [<80143ef8>] (kernel_restart+0xc/0x50)
+      (kernel_restart) from [<801441cc>] (__do_sys_reboot+0x18c/0x210)
+      (__do_sys_reboot) from [<80100060>] (ret_fast_syscall+0x0/0x28)
+    DMA-API: Mapped at:
+     dma_alloc_attrs+0xa4/0x130
+     dspi_probe+0x568/0x7b4
+     platform_drv_probe+0x6c/0xa4
+     really_probe+0x208/0x348
+     driver_probe_device+0x5c/0xb4
+
+Fixes: 90ba37033cb9 ("spi: spi-fsl-dspi: Add DMA support for Vybrid")
+Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
+Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/1591803717-11218-1-git-send-email-krzk@kernel.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-fsl-dspi.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/spi/spi-fsl-dspi.c
++++ b/drivers/spi/spi-fsl-dspi.c
+@@ -584,14 +584,14 @@ static void dspi_release_dma(struct fsl_
+               return;
+       if (dma->chan_tx) {
+-              dma_unmap_single(dma->chan_tx->device->dev, dma->tx_dma_phys,
+-                               dma_bufsize, DMA_TO_DEVICE);
++              dma_free_coherent(dma->chan_tx->device->dev, dma_bufsize,
++                                dma->tx_dma_buf, dma->tx_dma_phys);
+               dma_release_channel(dma->chan_tx);
+       }
+       if (dma->chan_rx) {
+-              dma_unmap_single(dma->chan_rx->device->dev, dma->rx_dma_phys,
+-                               dma_bufsize, DMA_FROM_DEVICE);
++              dma_free_coherent(dma->chan_rx->device->dev, dma_bufsize,
++                                dma->rx_dma_buf, dma->rx_dma_phys);
+               dma_release_channel(dma->chan_rx);
+       }
+ }