public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: bridge: Allow base 16 inputs in sysfs
@ 2021-11-24 10:11 Ido Schimmel
  2021-11-24 10:17 ` Nikolay Aleksandrov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-11-24 10:11 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, nikolay, roopa, bernard, David.Laight, mlxsw,
	Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

Cited commit converted simple_strtoul() to kstrtoul() as suggested by
the former's documentation. However, it also forced all the inputs to be
decimal resulting in user space breakage.

Fix by setting the base to '0' so that the base is automatically
detected.

Before:

 # ip link add name br0 type bridge vlan_filtering 1
 # echo "0x88a8" > /sys/class/net/br0/bridge/vlan_protocol
 bash: echo: write error: Invalid argument

After:

 # ip link add name br0 type bridge vlan_filtering 1
 # echo "0x88a8" > /sys/class/net/br0/bridge/vlan_protocol
 # echo $?
 0

Fixes: 520fbdf7fb19 ("net/bridge: replace simple_strtoul to kstrtol")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/bridge/br_sysfs_br.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 11c490694296..159590d5c2af 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -41,7 +41,7 @@ static ssize_t store_bridge_parm(struct device *d,
 	if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
 		return -EPERM;
 
-	err = kstrtoul(buf, 10, &val);
+	err = kstrtoul(buf, 0, &val);
 	if (err != 0)
 		return err;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-25  1:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-24 10:11 [PATCH net-next] net: bridge: Allow base 16 inputs in sysfs Ido Schimmel
2021-11-24 10:17 ` Nikolay Aleksandrov
2021-11-24 12:55 ` David Laight
2021-11-24 13:16   ` Ido Schimmel
2021-11-25  1:30 ` 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