bonding: initialize err for empty target lists
Subsystems (3)
PATCH 1/1 bonding: initialize err for empty target lists
Empty NLA_NESTED attributes are valid, and bonding uses them to clear the ARP and NS target lists. When either target attribute is empty, nla_for_each_nested() does not execute, so err retains an uninitialized value before it is tested. The request can consequently return an unpredictable error after clearing the targets.
Initialize err to zero so an empty target list completes successfully. Non-empty lists still propagate errors from __bond_opt_set() unchanged.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/net/bonding/bond_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_netlink.c +1 -1
@@ -220,7 +220,7 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],struct bonding *bond =netdev_priv (bond_dev);struct bond_opt_value newval;int miimon =0 ; -int err; +int err =0 ;if (!data)return 0 ;
Signature · 1 line
2.51.0
Quoted 23 lines · Ruoyu Wang
Empty
NLA_NESTEDattributes are valid, and bonding uses them to clear the ARP and NS target lists. When either target attribute is empty,nla_for_each_nested()does not execute, so err retains an uninitialized value before it is tested. The request can consequently return an unpredictable error after clearing the targets.Initialize err to zero so an empty target list completes successfully. Non-empty lists still propagate errors from
__bond_opt_set()unchanged.This issue was found by a static analysis checker and confirmed by manual source review.
Fixes 4fb0ef585eb2 ("bonding: convert arp_ip_target to use the new option API")Signed-off-by Ruoyu Wang <[email protected]>--- drivers/net/bonding/bond_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bonding/bond_netlink.c +0
-0
drivers/net/bonding/bond_netlink.c static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[], · line 226
Quoted 8 lines
drivers/net/bonding/bond_netlink.c +1
-1@@ -220,7 +220,7 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],struct bonding *bond =netdev_priv (bond_dev);struct bond_opt_value newval;int miimon =0 ; -int err; +int err =0 ;if (!data)return 0 ;
Oh well, I've missed they can be empty. :)
By the way you haven't CCed the Fixes commit author (me).
Thanks,
Quoted 1 line
By the way you haven't CCed the Fixes commit author (me).
Hi Nikolay
./scripts/get_maintainer.pl drivers/net/bonding/bond_netlink.c Jay Vosburgh <[email protected]> (maintainer:BONDING DRIVER) Andrew Lunn <[email protected]> (maintainer:NETWORKING DRIVERS) "David S. Miller" <[email protected]> (maintainer:NETWORKING DRIVERS) Eric Dumazet <[email protected]> (maintainer:NETWORKING DRIVERS) Jakub Kicinski <[email protected]> (maintainer:NETWORKING DRIVERS) Paolo Abeni <[email protected]> (maintainer:NETWORKING DRIVERS) [email protected] (open list:BONDING DRIVER) [email protected] (open list)
You are not listed. Maybe you can submit a patch to MAINTAINERS?
Andrew
Quoted 14 lines · Andrew Lunn
Quoted 1 line
By the way you haven't CCed the Fixes commit author (me).
Hi Nikolay
./scripts/get_maintainer.pldrivers/net/bonding/bond_netlink.cJay Vosburgh <[email protected]> (maintainer:BONDING DRIVER) Andrew Lunn <[email protected]> (maintainer:NETWORKING DRIVERS) "David S. Miller" <[email protected]> (maintainer:NETWORKING DRIVERS) Eric Dumazet <[email protected]> (maintainer:NETWORKING DRIVERS) Jakub Kicinski <[email protected]> (maintainer:NETWORKING DRIVERS) Paolo Abeni <[email protected]> (maintainer:NETWORKING DRIVERS) [email protected] (open list:BONDING DRIVER) [email protected] (open list)
Quoted 3 lines
You are not listed. Maybe you can submit a patch to
MAINTAINERS?Andrew
I didn't mean it as a maintainer, it is customary and good practice to email the author of the commit that introduced the regression, that is all I was trying to say.
Cheers,
Nik
Quoted 15 lines · Nikolay Aleksandrov
Quoted 14 lines · Andrew Lunn
Quoted 1 line
By the way you haven't CCed the Fixes commit author (me).
Hi Nikolay
./scripts/get_maintainer.pldrivers/net/bonding/bond_netlink.cJay Vosburgh <[email protected]> (maintainer:BONDING DRIVER) Andrew Lunn <[email protected]> (maintainer:NETWORKING DRIVERS) "David S. Miller" <[email protected]> (maintainer:NETWORKING DRIVERS) Eric Dumazet <[email protected]> (maintainer:NETWORKING DRIVERS) Jakub Kicinski <[email protected]> (maintainer:NETWORKING DRIVERS) Paolo Abeni <[email protected]> (maintainer:NETWORKING DRIVERS) [email protected] (open list:BONDING DRIVER) [email protected] (open list)
Quoted 7 lines
Quoted 3 lines
You are not listed. Maybe you can submit a patch to
MAINTAINERS?Andrew
I didn't mean it as a maintainer, it is customary and good practice to email the author of the commit that introduced the regression, that is all I was trying to say.
Interesting:
scripts/get_maintainer.pl --help
usage: scripts/get_maintainer.pl [options] patchfile
scripts/get_maintainer.pl [options] -f file|directory
version: 0.26
MAINTAINER field selection options:
--email => print email address(es) if any
...
--fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on))
So it should of done it, if it was run on the patch, rather than the file.
I wounder what "b4 prep --auto-to-cc" does?
Andrew
Jakub Kicinski
maintainerQuoted 11 lines · On Fri, 14 Aug 2026 02:44:11 +0200 Andrew Lunn wrote:
Quoted 3 lines
I didn't mean it as a maintainer, it is customary and good practice to email the author of the commit that introduced the regression, that is all I was trying to say.
Interesting:
scripts/get_maintainer.pl--help
usage:scripts/get_maintainer.pl[options] patchfile
scripts/get_maintainer.pl[options] -f file|directory
version: 0.26
Quoted 7 lines
MAINTAINER field selection options:
--email => print email address(es) if any
...
--fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on))So it should of done it, if it was run on the patch, rather than the file.
FWIW it's a common mistake to run get maint on a file path. I sent a patch once to print a WARNING when paths are used. But apparently the path case has at least one important user - Linus :)
Quoted 6 lines · Ruoyu Wang
Empty
NLA_NESTEDattributes are valid, and bonding uses them to clear the ARP and NS target lists. When either target attribute is empty,nla_for_each_nested()does not execute, so err retains an uninitialized value before it is tested. The request can consequently return an unpredictable error after clearing the targets.
Quoted 8 lines
Initialize err to zero so an empty target list completes successfully. Non-empty lists still propagate errors from
__bond_opt_set()unchanged.This issue was found by a static analysis checker and confirmed by manual source review.
Fixes 4fb0ef585eb2 ("bonding: convert arp_ip_target to use the new option API")Signed-off-by Ruoyu Wang <[email protected]>
Quoted 20 lines
---
drivers/net/bonding/bond_netlink.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bonding/bond_netlink.c +1
-1@@ -220,7 +220,7 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],struct bonding *bond =netdev_priv (bond_dev);struct bond_opt_value newval;int miimon =0 ; -int err; +int err =0 ;if (!data)return 0 ;Signature · 1 line
2.51.0
Quoted 34 lines · Ruoyu Wang
Empty
NLA_NESTEDattributes are valid, and bonding uses them to clear the ARP and NS target lists. When either target attribute is empty,nla_for_each_nested()does not execute, so err retains an uninitialized value before it is tested. The request can consequently return an unpredictable error after clearing the targets.Initialize err to zero so an empty target list completes successfully. Non-empty lists still propagate errors from
__bond_opt_set()unchanged.This issue was found by a static analysis checker and confirmed by manual source review.
Fixes 4fb0ef585eb2 ("bonding: convert arp_ip_target to use the new option API")Signed-off-by Ruoyu Wang <[email protected]>--- drivers/net/bonding/bond_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bonding/bond_netlink.c +1
-1@@ -220,7 +220,7 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],struct bonding *bond =netdev_priv (bond_dev);struct bond_opt_value newval;int miimon =0 ; -int err; +int err =0 ;if (!data)return 0 ;Signature · 1 line
2.51.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 10 lines · On Thu, 13 Aug 2026 23:31:26 +0800 you wrote:
Empty
NLA_NESTEDattributes are valid, and bonding uses them to clear the ARP and NS target lists. When either target attribute is empty,nla_for_each_nested()does not execute, so err retains an uninitialized value before it is tested. The request can consequently return an unpredictable error after clearing the targets.Initialize err to zero so an empty target list completes successfully. Non-empty lists still propagate errors from
__bond_opt_set()unchanged.[...]
Here is the summary with links:
- [net] bonding: initialize err for empty target lists
https://git.kernel.org/netdev/net/c/8ccc9bf9afee
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html