diff options
author | Paul Mackerras <paulus@samba.org> | 2007-08-28 15:56:11 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-08-28 15:56:11 +1000 |
commit | 35438c4327df18dbf5e7f597b69299119f4a14de (patch) | |
tree | a4589d731015db93f2eba8f84ffb1f48a8084020 /net/bridge/br_sysfs_br.c | |
parent | 2f6c9d961081dc7b109eb19166244bcb2a5dfc28 (diff) | |
parent | b07d68b5ca4d55a16fab223d63d5fb36f89ff42f (diff) | |
download | op-kernel-dev-35438c4327df18dbf5e7f597b69299119f4a14de.zip op-kernel-dev-35438c4327df18dbf5e7f597b69299119f4a14de.tar.gz |
Merge branch 'linux-2.6' into for-2.6.24
Diffstat (limited to 'net/bridge/br_sysfs_br.c')
-rw-r--r-- | net/bridge/br_sysfs_br.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index 4f42263..c65f54e 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c @@ -147,20 +147,27 @@ static ssize_t show_stp_state(struct device *d, return sprintf(buf, "%d\n", br->stp_enabled); } -static void set_stp_state(struct net_bridge *br, unsigned long val) -{ - rtnl_lock(); - spin_unlock_bh(&br->lock); - br_stp_set_enabled(br, val); - spin_lock_bh(&br->lock); - rtnl_unlock(); -} static ssize_t store_stp_state(struct device *d, struct device_attribute *attr, const char *buf, size_t len) { - return store_bridge_parm(d, buf, len, set_stp_state); + struct net_bridge *br = to_bridge(d); + char *endp; + unsigned long val; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + val = simple_strtoul(buf, &endp, 0); + if (endp == buf) + return -EINVAL; + + rtnl_lock(); + br_stp_set_enabled(br, val); + rtnl_unlock(); + + return len; } static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, store_stp_state); |