Subject: Re: [PATCH net] net: ethernet: mtk_eth_soc: Reset prog ptr to NULL in case of error in mtk_xdp_setup()

From: Jakub Kicinski <[email-masked]>
Date: Mon, 2 Mar 2026 18:29:09 -0800

On Fri, 27 Feb 2026 16:52:11 +0100 Lorenzo Bianconi wrote:
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -3751,8 +3751,16 @@ static int mtk_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
>  	if (old_prog)
>  		bpf_prog_put(old_prog);
>  
> -	if (netif_running(dev) && need_update)
> -		return mtk_open(dev);
> +	if (netif_running(dev) && need_update) {
> +		int err;
> +
> +		err = mtk_open(dev);
> +		if (err) {
> +			rcu_assign_pointer(eth->prog, NULL);
> +
> +			return err;
> +		}
> +	}
>  
>  	return 0;

Maybe there's something special here, not obvious without context,
but why are we setting eth->prog to NULL rather than old_prog?
At the very least the commit message needs to explain..
-- 
pw-bot: cr