Skip to content

Commit 78aa0aa

Browse files
nikita-youshgregkh
authored andcommitted
net: renesas: rswitch: fix leaked pointer on error path
[ Upstream commit bb61732 ] If error path is taken while filling descriptor for a frame, skb pointer is left in the entry. Later, on the ring entry reuse, the same entry could be used as a part of a multi-descriptor frame, and skb for that new frame could be stored in a different entry. Then, the stale pointer will reach the completion routine, and passed to the release operation. Fix that by clearing the saved skb pointer at the error path. Fixes: d2c96b9 ("net: rswitch: Add jumbo frames handling for TX") Signed-off-by: Nikita Yushchenko <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 0c316b6 commit 78aa0aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/renesas/rswitch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ static netdev_tx_t rswitch_start_xmit(struct sk_buff *skb, struct net_device *nd
16311631
return ret;
16321632

16331633
err_unmap:
1634+
gq->skbs[(gq->cur + nr_desc - 1) % gq->ring_size] = NULL;
16341635
dma_unmap_single(ndev->dev.parent, dma_addr_orig, skb->len, DMA_TO_DEVICE);
16351636

16361637
err_kfree:

0 commit comments

Comments
 (0)