RE: [PATCH net] ravb: Fix potential use-after-free in ravb_rx_gbeth()
From: Biju Das
Date: Sat Dec 03 2022 - 05:29:21 EST
Hi YueHaibing,
Thanks for the feedback.
> Subject: [PATCH net] ravb: Fix potential use-after-free in
> ravb_rx_gbeth()
>
> The skb is delivered to napi_gro_receive() which may free it, after
> calling this, dereferencing skb may trigger use-after-free.
Can you please reconfirm the changes you have done is actually fixing any issue?
If yes, please provide the details.
Current code,
napi_gro_receive(&priv->napi[q], priv->rx_1st_skb);
- stats->rx_bytes += priv->rx_1st_skb->len;
+ stats->rx_bytes += pkt_len;
Note: I haven't tested your patch yet to see it cause any regression.
Cheers,
Biju
>
> Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
> Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
> ---
> drivers/net/ethernet/renesas/ravb_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> b/drivers/net/ethernet/renesas/ravb_main.c
> index 6bc923326268..33f723a9f471 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -841,7 +841,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;
> }
> }
> --
> 2.34.1