[BRIDGE]: Missing rtnl.
[powerpc.git] / net / bridge / br_sysfs_br.c
index ce10464..33c6c4a 100644 (file)
@@ -149,7 +149,11 @@ static ssize_t show_stp_state(struct device *d,
 
 static void set_stp_state(struct net_bridge *br, unsigned long val)
 {
-       br->stp_enabled = 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,
@@ -309,6 +313,19 @@ static ssize_t store_group_addr(struct device *d,
 static DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR,
                   show_group_addr, store_group_addr);
 
+static ssize_t store_flush(struct device *d,
+                          struct device_attribute *attr,
+                          const char *buf, size_t len)
+{
+       struct net_bridge *br = to_bridge(d);
+
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       br_fdb_flush(br);
+       return len;
+}
+static DEVICE_ATTR(flush, S_IWUSR, NULL, store_flush);
 
 static struct attribute *bridge_attrs[] = {
        &dev_attr_forward_delay.attr,
@@ -328,6 +345,7 @@ static struct attribute *bridge_attrs[] = {
        &dev_attr_topology_change_timer.attr,
        &dev_attr_gc_timer.attr,
        &dev_attr_group_addr.attr,
+       &dev_attr_flush.attr,
        NULL
 };
 
@@ -353,19 +371,19 @@ static ssize_t brforward_read(struct kobject *kobj, char *buf,
        if (off % sizeof(struct __fdb_entry) != 0)
                return -EINVAL;
 
-       n =  br_fdb_fillbuf(br, buf, 
+       n =  br_fdb_fillbuf(br, buf,
                            count / sizeof(struct __fdb_entry),
                            off / sizeof(struct __fdb_entry));
 
        if (n > 0)
                n *= sizeof(struct __fdb_entry);
-       
+
        return n;
 }
 
 static struct bin_attribute bridge_forward = {
        .attr = { .name = SYSFS_BRIDGE_FDB,
-                 .mode = S_IRUGO, 
+                 .mode = S_IRUGO,
                  .owner = THIS_MODULE, },
        .read = brforward_read,
 };
@@ -401,7 +419,7 @@ int br_sysfs_addbr(struct net_device *dev)
                goto out2;
        }
 
-       
+
        kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
        br->ifobj.ktype = NULL;
        br->ifobj.kset = NULL;