aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Yushchenko <[email protected]>2024-12-08 14:50:03 +0500
committerJakub Kicinski <[email protected]>2024-12-10 19:02:47 -0800
commitbb617328bafa1023d8e9c25a25345a564c66c14f (patch)
treeccb0a2bcdf7b3d8b096ac38994f32ee8e8eba986
parent0c9547e6ccf40455b0574cf589be3b152a3edf5b (diff)
net: renesas: rswitch: fix leaked pointer on error path
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: d2c96b9d5f83 ("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]>
-rw-r--r--drivers/net/ethernet/renesas/rswitch.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index cdf4d6ccccb0..6d6912b9c16e 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1703,6 +1703,7 @@ static netdev_tx_t rswitch_start_xmit(struct sk_buff *skb, struct net_device *nd
return ret;
err_unmap:
+ gq->skbs[(gq->cur + nr_desc - 1) % gq->ring_size] = NULL;
dma_unmap_single(ndev->dev.parent, dma_addr_orig, skb->len, DMA_TO_DEVICE);
err_kfree: