Skip to contentSkip to conversation

patch "staging: mt7621-dma: fix potentially dereferencing uninitialized" added to staging-linus

PATCH [email protected] 1 participant 1 message Nov 7, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: mt7621-dma: fix potentially dereferencing uninitialized

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 354e379684fcc70ab8d5450b4d57bd92b5294dfd Mon Sep 17 00:00:00 2001

From: Sergio Paracuellos <[email protected]>
Date: Sat, 20 Oct 2018 13:31:06 +0200
Subject: staging: mt7621-dma: fix potentially dereferencing uninitialized
'tx_desc'

Function 'mtk_hsdma_start_transfer' uses 'tx_desc' pointer which can be dereferenced before it is initializated. Initializate pointer before avoiding the problem.

Fixes 0853c7a53eb3 ("staging: mt7621-dma: ralink: add rt2880 dma engine")
Cc stable <[email protected]>
---
 drivers/staging/mt7621-dma/mtk-hsdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/mt7621-dma/mtk-hsdma.c +2 -1
index df6ebf41bdea..5831f816c17b 100644
@@ -335,6 +335,8 @@ static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
 	/* tx desc */
 	src = sg->src_addr;
 	for (i = 0; i < chan->desc->num_sgs; i++) {
+		tx_desc = &chan->tx_ring[chan->tx_idx];
+
 		if (len > HSDMA_MAX_PLEN)
 			tlen = HSDMA_MAX_PLEN;
 		else
@@ -344,7 +346,6 @@ static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
 			tx_desc->addr1 = src;
 			tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
 		} else {
-			tx_desc = &chan->tx_ring[chan->tx_idx];
 			tx_desc->addr0 = src;
 			tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
 
Signature · 1 line
2.19.1