Skip to contentSkip to conversation

Patch "net: mvpp2: release reference to txq_cpu[] entry after unmapping" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Oct 19, 2017

Subsystems (2)
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

    net: mvpp2: release reference to txq_cpu[] entry after unmapping

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:
net-mvpp2-release-reference-to-txq_cpu-entry-after-unmapping.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 Thu Oct 19 15:15:46 CEST 2017

From: Thomas Petazzoni <[email protected]>
Date: Tue, 21 Feb 2017 11:28:05 +0100
Subject: net: mvpp2: release reference to txq_cpu[] entry after unmapping

From: Thomas Petazzoni <[email protected]>

[ Upstream commit 36fb7435b6ac4d288a2d4deea8934f9456ab46b6 ]

The mvpp2_txq_bufs_free() function is called upon TX completion to DMA unmap TX buffers, and free the corresponding SKBs. It gets the references to the SKB to free and the DMA buffer to unmap from a per-CPU txq_pcpu data structure.

However, the code currently increments the pointer to the next entry before doing the DMA unmap and freeing the SKB. It does not cause any visible problem because for a given SKB the TX completion is guaranteed to take place on the CPU where the TX was started. However, it is much more logical to increment the pointer to the next entry once the current entry has been completely unmapped/released.

---
 drivers/net/ethernet/marvell/mvpp2.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/mvpp2.c +4 -5
@@ -4415,13 +4415,12 @@ static void mvpp2_txq_bufs_free(struct m
 		struct mvpp2_txq_pcpu_buf *tx_buf =
 			txq_pcpu->buffs + txq_pcpu->txq_get_index;
 
-		mvpp2_txq_inc_get(txq_pcpu);
-
 		dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
 				 tx_buf->size, DMA_TO_DEVICE);
-		if (!tx_buf->skb)
-			continue;
-		dev_kfree_skb_any(tx_buf->skb);
+		if (tx_buf->skb)
+			dev_kfree_skb_any(tx_buf->skb);
+
+		mvpp2_txq_inc_get(txq_pcpu);
 	}
 }
 

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

queue-4.4/net-mvpp2-release-reference-to-txq_cpu-entry-after-unmapping.patch