Stable Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH AUTOSEL 5.4 001/205] ioat: ioat_alloc_ring() failure handling.
@ 2020-01-16 16:39 Sasha Levin
  2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 002/205] drm/panfrost: Add missing check for pfdev->regulator Sasha Levin
                   ` (203 more replies)
  0 siblings, 204 replies; 213+ messages in thread
From: Sasha Levin @ 2020-01-16 16:39 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander.Barabash, Alexander Barabash, Dave Jiang, Vinod Koul,
	Sasha Levin, dmaengine

From: "Alexander.Barabash@dell.com" <Alexander.Barabash@dell.com>

[ Upstream commit b0b5ce1010ffc50015eaec72b0028aaae3f526bb ]

If dma_alloc_coherent() returns NULL in ioat_alloc_ring(), ring
allocation must not proceed.

Until now, if the first call to dma_alloc_coherent() in
ioat_alloc_ring() returned NULL, the processing could proceed, failing
with NULL-pointer dereferencing further down the line.

Signed-off-by: Alexander Barabash <alexander.barabash@dell.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/75e9c0e84c3345d693c606c64f8b9ab5@x13pwhopdag1307.AMER.DELL.COM
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/ioat/dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 1a422a8b43cf..18c011e57592 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -377,10 +377,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags)
 
 		descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
 						 SZ_2M, &descs->hw, flags);
-		if (!descs->virt && (i > 0)) {
+		if (!descs->virt) {
 			int idx;
 
 			for (idx = 0; idx < i; idx++) {
+				descs = &ioat_chan->descs[idx];
 				dma_free_coherent(to_dev(ioat_chan), SZ_2M,
 						  descs->virt, descs->hw);
 				descs->virt = NULL;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 213+ messages in thread

end of thread, back to index

Thread overview: 213+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 16:39 [PATCH AUTOSEL 5.4 001/205] ioat: ioat_alloc_ring() failure handling Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 002/205] drm/panfrost: Add missing check for pfdev->regulator Sasha Levin
2020-01-17 16:12   ` Steven Price
2020-01-17 16:59     ` Greg KH
2020-01-18  8:18       ` Dan Carpenter
2020-01-18 13:18         ` Greg KH
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 003/205] drm/v3d: don't leak bin job if v3d_job_init fails Sasha Levin
2020-01-17  7:25   ` Iago Toral
2020-01-23 14:17     ` Sasha Levin
2020-01-23 15:46       ` Iago Toral
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 004/205] drm: panel-lvds: Potential Oops in probe error handling Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 005/205] scsi: lpfc: Fix hdwq sgl locks and irq handling Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 006/205] scsi: lpfc: Fix list corruption detected in lpfc_put_sgl_per_hdwq Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 007/205] arm64: dts: renesas: r8a77970: Fix PWM3 Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 008/205] mt7601u: fix bbp version check in mt7601u_wait_bbp_ready Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 009/205] RDMA/counter: Prevent QP counter manual binding in auto mode Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 010/205] RDMA/siw: Fix port number endianness in a debug message Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 011/205] soc/tegra: pmc: Fix crashes for hierarchical interrupts Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 012/205] spi: lpspi: fix memory leak in fsl_lpspi_probe Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 013/205] media: rcar-vin: Fix incorrect return statement in rvin_try_format() Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 014/205] media: ov6650: Fix incorre