From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, jv@jvosburgh.net,
joamaki@gmail.com, daniel@iogearbox.net
Subject: Re: [PATCH net] bonding: fix the program leak when XDP is replaced
Date: Thu, 1 Oct 2026 19:40:38 +0800 [thread overview]
Message-ID: <ddd0a7d0-3aae-4847-a592-4b429762bdc7@linux.dev> (raw)
In-Reply-To: <20261001012639.298690-1-kuba@kernel.org>
On 10/1/26 9:26 AM, Jakub Kicinski wrote:
> We need to release the reference on the old BPF prog, whether
> we are going to no-prog, or replacing the prog with another.
>
> Spotted by AI while running tests for the propagation series
> (leaked programs were accumulating). Selftest will come in
> the net-next series to avoid conflicts.
>
> Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver")
> Fixes: 6d5f1ef83868 ("bonding: Fix negative jump label count on nested bonding")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
> ---
> CC: jv@jvosburgh.net
> CC: joamaki@gmail.com
> CC: daniel@iogearbox.net
> ---
> drivers/net/bonding/bond_main.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index de2489c3d9bf..09aa45d71fab 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -5732,12 +5732,12 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> bpf_prog_inc(prog);
> }
>
> - if (prog) {
> + if (prog && !old_prog)
> static_branch_inc(&bpf_master_redirect_enabled_key);
> - } else if (old_prog) {
> - bpf_prog_put(old_prog);
> + else if (!prog && old_prog)
> static_branch_dec(&bpf_master_redirect_enabled_key);
> - }
> + if (old_prog)
> + bpf_prog_put(old_prog);
>
> return 0;
>
next prev parent reply other threads:[~2026-10-01 11:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 1:26 [PATCH net] bonding: fix the program leak when XDP is replaced Jakub Kicinski
2026-10-01 9:42 ` Daniel Borkmann
2026-10-01 11:40 ` Jiayuan Chen [this message]
2026-10-02 20:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ddd0a7d0-3aae-4847-a592-4b429762bdc7@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joamaki@gmail.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox