net: bridge: Bounce invalid boolopts
Subsystems (3)
PATCH 1/1 net: bridge: Bounce invalid boolopts
The bridge driver currently tolerates options that it does not recognize. Instead, it should bounce them.
--- net/bridge/br.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/bridge/br.c +7 -0
@@ -346,6 +346,13 @@ int br_boolopt_multi_toggle(struct net_bridge *br,int err =0 ;int opt_id; + opt_id =find_next_bit (&bitmap,BITS_PER_LONG ,BR_BOOLOPT_MAX ); +if (opt_id !=BITS_PER_LONG ) { +NL_SET_ERR_MSG_FMT_MOD (extack,"Unknown boolean option %d" , + opt_id); +return -EINVAL ; + } +for_each_set_bit (opt_id, &bitmap,BR_BOOLOPT_MAX ) {bool on = !!(bm->optval &BIT (opt_id));
Signature · 1 line
2.49.0
Quoted 18 lines · Petr Machata
The bridge driver currently tolerates options that it does not recognize. Instead, it should bounce them.
Fixes a428afe82f98 ("net: bridge: add support for user-controlled bool options")Signed-off-by Petr Machata <[email protected]>Reviewed-by Ido Schimmel <[email protected]>--- net/bridge/br.c | 7 +++++++ 1 file changed, 7 insertions(+)net/bridge/br.c +0
-0@@ -346,6 +346,13 @@ int br_boolopt_multi_toggle(struct net_bridge *br,int err =0 ;int opt_id;
net/bridge/br.c int br_boolopt_multi_toggle(struct net_bridge *br, · line 358
Quoted 10 lines
net/bridge/br.c +7
-0+ opt_id =find_next_bit (&bitmap,BITS_PER_LONG ,BR_BOOLOPT_MAX ); +if (opt_id !=BITS_PER_LONG ) { +NL_SET_ERR_MSG_FMT_MOD (extack,"Unknown boolean option %d" , + opt_id); +return -EINVAL ; + } +for_each_set_bit (opt_id, &bitmap,BR_BOOLOPT_MAX ) {bool on = !!(bm->optval &BIT (opt_id));
IIRC at the time we did this was on purpose, the mask that is returned should show which options were actually set without disrupting the call.
Anyway I'm ok with returning an error for such options as well, thanks!
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 Fri, 5 Sep 2025 13:12:33 +0200 you wrote:
The bridge driver currently tolerates options that it does not recognize. Instead, it should bounce them.
Fixes a428afe82f98 ("net: bridge: add support for user-controlled bool options")Signed-off-by Petr Machata <[email protected]>Reviewed-by Ido Schimmel <[email protected]>[...]
Here is the summary with links:
- [net] net: bridge: Bounce invalid boolopts
https://git.kernel.org/netdev/net/c/8625f5748fea
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html