Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=17120889b0706b69ae24cba3ef0a340dc3fb7edc
Commit:     17120889b0706b69ae24cba3ef0a340dc3fb7edc
Parent:     45241a7a07537266eec363593ef377a1e6b7db7f
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 14 13:21:34 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Aug 14 13:21:34 2007 -0700

    [BRIDGE]: sysfs locking fix.
    
    The stp change code generates "sleeping function called from invalid
    context" because rtnl_lock() called with BH disabled. This fixes it by
    not acquiring then dropping the bridge lock.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/bridge/br_sysfs_br.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 4f42263..88f4300 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -147,20 +147,26 @@ 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();
+
 }
 static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
                   store_stp_state);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to