* [PATCH net] bonding: fix the program leak when XDP is replaced
@ 2026-10-01 1:26 Jakub Kicinski
2026-10-01 9:42 ` Daniel Borkmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-10-01 1:26 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
jv, joamaki, daniel
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>
---
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;
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] bonding: fix the program leak when XDP is replaced
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
2026-10-02 20:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2026-10-01 9:42 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, jv, joamaki
On 10/1/26 3: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>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] bonding: fix the program leak when XDP is replaced
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
2026-10-02 20:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jiayuan Chen @ 2026-10-01 11:40 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, jv, joamaki,
daniel
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;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] bonding: fix the program leak when XDP is replaced
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
@ 2026-10-02 20:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-10-02 20:00 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, jv,
joamaki, daniel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 30 Sep 2026 18:26:39 -0700 you 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.
>
> [...]
Here is the summary with links:
- [net] bonding: fix the program leak when XDP is replaced
https://git.kernel.org/netdev/net/c/184b5ddf82d4
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-02 20:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-10-02 20:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox