Skip to content

Commit 5e84e18

Browse files
pmachatagregkh
authored andcommitted
net: bridge: Bounce invalid boolopts
[ Upstream commit 8625f57 ] The bridge driver currently tolerates options that it does not recognize. Instead, it should bounce them. Fixes: a428afe ("net: bridge: add support for user-controlled bool options") Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/e6fdca3b5a8d54183fbda075daffef38bdd7ddce.1757070067.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fe78891 commit 5e84e18

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net/bridge/br.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ int br_boolopt_multi_toggle(struct net_bridge *br,
312312
int err = 0;
313313
int opt_id;
314314

315+
opt_id = find_next_bit(&bitmap, BITS_PER_LONG, BR_BOOLOPT_MAX);
316+
if (opt_id != BITS_PER_LONG) {
317+
NL_SET_ERR_MSG_FMT_MOD(extack, "Unknown boolean option %d",
318+
opt_id);
319+
return -EINVAL;
320+
}
321+
315322
for_each_set_bit(opt_id, &bitmap, BR_BOOLOPT_MAX) {
316323
bool on = !!(bm->optval & BIT(opt_id));
317324

0 commit comments

Comments
 (0)