Skip to contentSkip to conversation

Patch "sh_eth: advance 'rxdesc' later in sh_eth_ring_format()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 16, 2016

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

sh_eth: advance 'rxdesc' later in sh_eth_ring_format()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sh_eth-advance-rxdesc-later-in-sh_eth_ring_format.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sat Apr 16 10:02:53 PDT 2016

From: Sergei Shtylyov <[email protected]>
Date: Tue, 8 Mar 2016 01:37:09 +0300
Subject: sh_eth: advance 'rxdesc' later in sh_eth_ring_format()

From: Sergei Shtylyov <[email protected]>

[ Upstream commit d0ba913488dc8c55d1880f5ed34f096dc45fb05d ]

Iff dma_map_single() fails, 'rxdesc' should point to the last filled RX descriptor, so that it can be marked as the last one, however the driver would have already advanced it by that time. In order to fix that, only fill an RX descriptor once all the data for it is ready.

---
 drivers/net/ethernet/renesas/sh_eth.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +4 -3
@@ -1185,11 +1185,8 @@ static void sh_eth_ring_format(struct ne
 			break;
 		sh_eth_set_receive_align(skb);
 
-		/* RX descriptor */
-		rxdesc = &mdp->rx_ring[i];
 		/* The size of the buffer is a multiple of 32 bytes. */
 		buf_len = ALIGN(mdp->rx_buf_sz, 32);
-		rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
 		dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len,
 					  DMA_FROM_DEVICE);
 		if (dma_mapping_error(&ndev->dev, dma_addr)) {
@@ -1197,6 +1194,10 @@ static void sh_eth_ring_format(struct ne
 			break;
 		}
 		mdp->rx_skbuff[i] = skb;
+
+		/* RX descriptor */
+		rxdesc = &mdp->rx_ring[i];
+		rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
 		rxdesc->addr = cpu_to_edmac(mdp, dma_addr);
 		rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/sh_eth-fix-null-pointer-dereference-in-sh_eth_ring_format.patch queue-4.4/sh_eth-advance-rxdesc-later-in-sh_eth_ring_format.patch