diff mbox series

[5.10.y-cip,08/47] ravb: Fix potential use-after-free in ravb_rx_gbeth()

Message ID 20240529081039.639010-9-claudiu.beznea.uj@bp.renesas.com (mailing list archive)
State New
Headers show
Series Add Ethernet support for Renesas RZ/G3S SoC | expand

Commit Message

Claudiu Beznea May 29, 2024, 8:10 a.m. UTC
From: YueHaibing <yuehaibing@huawei.com>

commit 5a5a3e564de6a8db987410c5c2f4748d50ea82b8 upstream.

The skb is delivered to napi_gro_receive() which may free it, after calling this,
dereferencing skb may trigger use-after-free.

Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20221203092941.10880-1-yuehaibing@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index fd1c5ee676b7..23fb75b9ee0d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -838,7 +838,7 @@  static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
 				napi_gro_receive(&priv->napi[q],
 						 priv->rx_1st_skb);
 				stats->rx_packets++;
-				stats->rx_bytes += priv->rx_1st_skb->len;
+				stats->rx_bytes += pkt_len;
 				break;
 			}
 		}