aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>2013-08-20 04:10:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-14 09:54:55 -0400
commit9f0bd377e1210501cd11eef80159e5d7f6160fef (patch)
tree550d471053e64487a2434ef8b56c4c2c770fe688
parentfc26e4cf6f6be400ea7b5442982c58e76b6beda4 (diff)
bridge: Use the correct bit length for bitmap functions in the VLAN code
[ Upstream commit ef40b7ef181b7b1a24df2ef2d1ef84956bffa635 ] The VLAN code needs to know the length of the per-port VLAN bitmap to perform its most basic operations (retrieving VLAN informations, removing VLANs, forwarding database manipulation, etc). Unfortunately, in the current implementation we are using a macro that indicates the bitmap size in longs in places where the size in bits is expected, which in some cases can cause what appear to be random failures. Use the correct macro. Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/bridge/br_fdb.c10
-rw-r--r--net/bridge/br_netlink.c4
-rw-r--r--net/bridge/br_vlan.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index ebfa4443c69b..84dd783abe5c 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -161,7 +161,7 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr)
161 if (!pv) 161 if (!pv)
162 return; 162 return;
163 163
164 for_each_set_bit_from(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) { 164 for_each_set_bit_from(vid, pv->vlan_bitmap, VLAN_N_VID) {
165 f = __br_fdb_get(br, br->dev->dev_addr, vid); 165 f = __br_fdb_get(br, br->dev->dev_addr, vid);
166 if (f && f->is_local && !f->dst) 166 if (f && f->is_local && !f->dst)
167 fdb_delete(br, f); 167 fdb_delete(br, f);
@@ -725,7 +725,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
725 /* VID was specified, so use it. */ 725 /* VID was specified, so use it. */
726 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); 726 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
727 } else { 727 } else {
728 if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) { 728 if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {
729 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); 729 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0);
730 goto out; 730 goto out;
731 } 731 }
@@ -734,7 +734,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
734 * specify a VLAN. To be nice, add/update entry for every 734 * specify a VLAN. To be nice, add/update entry for every
735 * vlan on this port. 735 * vlan on this port.
736 */ 736 */
737 for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) { 737 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
738 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); 738 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
739 if (err) 739 if (err)
740 goto out; 740 goto out;
@@ -812,7 +812,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
812 812
813 err = __br_fdb_delete(p, addr, vid); 813 err = __br_fdb_delete(p, addr, vid);
814 } else { 814 } else {
815 if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) { 815 if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {
816 err = __br_fdb_delete(p, addr, 0); 816 err = __br_fdb_delete(p, addr, 0);
817 goto out; 817 goto out;
818 } 818 }
@@ -822,7 +822,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
822 * vlan on this port. 822 * vlan on this port.
823 */ 823 */
824 err = -ENOENT; 824 err = -ENOENT;
825 for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) { 825 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
826 err &= __br_fdb_delete(p, addr, vid); 826 err &= __br_fdb_delete(p, addr, vid);
827 } 827 }
828 } 828 }
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 8e3abf564798..f66a03453a8e 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -128,7 +128,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
128 else 128 else
129 pv = br_get_vlan_info(br); 129 pv = br_get_vlan_info(br);
130 130
131 if (!pv || bitmap_empty(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN)) 131 if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID))
132 goto done; 132 goto done;
133 133
134 af = nla_nest_start(skb, IFLA_AF_SPEC); 134 af = nla_nest_start(skb, IFLA_AF_SPEC);
@@ -136,7 +136,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
136 goto nla_put_failure; 136 goto nla_put_failure;
137 137
138 pvid = br_get_pvid(pv); 138 pvid = br_get_pvid(pv);
139 for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) { 139 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
140 vinfo.vid = vid; 140 vinfo.vid = vid;
141 vinfo.flags = 0; 141 vinfo.flags = 0;
142 if (vid == pvid) 142 if (vid == pvid)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index bd58b45f5f90..9a9ffe7e4019 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -108,7 +108,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
108 108
109 clear_bit(vid, v->vlan_bitmap); 109 clear_bit(vid, v->vlan_bitmap);
110 v->num_vlans--; 110 v->num_vlans--;
111 if (bitmap_empty(v->vlan_bitmap, BR_VLAN_BITMAP_LEN)) { 111 if (bitmap_empty(v->vlan_bitmap, VLAN_N_VID)) {
112 if (v->port_idx) 112 if (v->port_idx)
113 rcu_assign_pointer(v->parent.port->vlan_info, NULL); 113 rcu_assign_pointer(v->parent.port->vlan_info, NULL);
114 else 114 else
@@ -122,7 +122,7 @@ static void __vlan_flush(struct net_port_vlans *v)
122{ 122{
123 smp_wmb(); 123 smp_wmb();
124 v->pvid = 0; 124 v->pvid = 0;
125 bitmap_zero(v->vlan_bitmap, BR_VLAN_BITMAP_LEN); 125 bitmap_zero(v->vlan_bitmap, VLAN_N_VID);
126 if (v->port_idx) 126 if (v->port_idx)
127 rcu_assign_pointer(v->parent.port->vlan_info, NULL); 127 rcu_assign_pointer(v->parent.port->vlan_info, NULL);
128 else 128 else