bonding: fix the program leak when XDP is replaced
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 bonding: fix the program leak when XDP is replaced
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.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- drivers/net/bonding/bond_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bonding/bond_main.c +4 -4
@@ -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 ;
Signature · 1 line
2.55.0
Quoted 10 lines · Jakub Kicinski
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 <[email protected]>
Quoted 10 lines · Jakub Kicinski
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 <[email protected]>
Quoted 29 lines
---
CC: [email protected]
CC: [email protected]
CC: [email protected]--- drivers/net/bonding/bond_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/bonding/bond_main.c +4
-4@@ -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 ;
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html