Re: [PATCH net] bnxt_en: don't leave an XDP program installed when the open fails
From: Michael Chan
Date: Mon Sep 28 2026 - 17:01:45 EST
On Mon, Sep 28, 2026 at 6:15 AM Vaibhav Nagare <nagarevaibhav@xxxxxxxxx> wrote:
> Restore the previous program when the open fails and release it only
> once the change has been committed. The ring and feature configuration
> is left as computed for the rejected program; the device stays down on
> this path, and reconciling it is left for a separate change.
>
> Fixes: c6d30e8391b8 ("bnxt_en: Add basic XDP support.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Vaibhav Nagare <vnagare@xxxxxxxxxx>
> @@ -435,8 +433,16 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog)
> bnxt_set_tpa_flags(bp);
> bnxt_set_ring_params(bp);
>
> - if (netif_running(dev))
> - return bnxt_open_nic(bp, true, false);
> + if (netif_running(dev)) {
> + rc = bnxt_open_nic(bp, true, false);
> + if (rc) {
> + WRITE_ONCE(bp->xdp_prog, old);
> + return rc;
> + }
> + }
> +
> + if (old)
> + bpf_prog_put(old);
As mentioned in your commit message, the driver's internal ring state
and the XDP program state may be out-of-sync at this point. I think
bad things can happen if the next open succeeds. Ideally, we want to
get everything back in sync.
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature