[PATCH net 06/13] net: stmmac: Free temporary Rx SKB on request

Piotr Raczynski piotr.raczynski at intel.com
Tue Mar 14 04:26:49 PDT 2023


On Tue, Mar 14, 2023 at 01:42:30AM +0300, Serge Semin wrote:
> In case if an incoming frame couldn't be finished in one stmmac_rx()
> method call an SKB used to collect data so far will be saved in the
> corresponding Rx-queue state buffer. If the network device is closed
> before the frame is completed the preserved SKB will be utilized on the
> next network interface link uprising cycle right on the first frame
> reception, which will cause having a confused set of SKB data. Let's free
> the allocated Rx SKB then when all Rx-buffers are requested to be freed.
> 
> Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
> Signed-off-by: Serge Semin <Sergey.Semin at baikalelectronics.ru>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index ee4297a25521..4d643b1bbf65 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1545,6 +1545,10 @@ static void dma_free_rx_skbufs(struct stmmac_priv *priv,
>  
>  	for (i = 0; i < dma_conf->dma_rx_size; i++)
>  		stmmac_free_rx_buffer(priv, rx_q, i);
> +
> +	if (rx_q->state_saved)
> +		dev_kfree_skb(rx_q->state.skb);
> +	rx_q->state_saved = false;
>  }
>  
>  static int stmmac_alloc_rx_buffers(struct stmmac_priv *priv,
> -- 
> 2.39.2
> 
> 
LGTM, thanks.
Reviewed-by: Piotr Raczynski <piotr.raczynski at intel.com>



More information about the linux-arm-kernel mailing list