spec: set CONFIG_LOCALVERSION
[platform/kernel/linux-rpi.git] / net / bridge / br_vlan.c
index 19f65ab..86441ff 100644 (file)
@@ -560,10 +560,10 @@ static bool __allowed_ingress(const struct net_bridge *br,
                    !br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) {
                        if (*state == BR_STATE_FORWARDING) {
                                *state = br_vlan_get_pvid_state(vg);
-                               return br_vlan_state_allowed(*state, true);
-                       } else {
-                               return true;
+                               if (!br_vlan_state_allowed(*state, true))
+                                       goto drop;
                        }
+                       return true;
                }
        }
        v = br_vlan_find(vg, *vid);
@@ -904,6 +904,8 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto,
        list_for_each_entry(p, &br->port_list, list) {
                vg = nbp_vlan_group(p);
                list_for_each_entry(vlan, &vg->vlan_list, vlist) {
+                       if (vlan->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV)
+                               continue;
                        err = vlan_vid_add(p->dev, proto, vlan->vid);
                        if (err)
                                goto err_filt;
@@ -918,8 +920,11 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto,
        /* Delete VLANs for the old proto from the device filter. */
        list_for_each_entry(p, &br->port_list, list) {
                vg = nbp_vlan_group(p);
-               list_for_each_entry(vlan, &vg->vlan_list, vlist)
+               list_for_each_entry(vlan, &vg->vlan_list, vlist) {
+                       if (vlan->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV)
+                               continue;
                        vlan_vid_del(p->dev, oldproto, vlan->vid);
+               }
        }
 
        return 0;
@@ -928,13 +933,19 @@ err_filt:
        attr.u.vlan_protocol = ntohs(oldproto);
        switchdev_port_attr_set(br->dev, &attr, NULL);
 
-       list_for_each_entry_continue_reverse(vlan, &vg->vlan_list, vlist)
+       list_for_each_entry_continue_reverse(vlan, &vg->vlan_list, vlist) {
+               if (vlan->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV)
+                       continue;
                vlan_vid_del(p->dev, proto, vlan->vid);
+       }
 
        list_for_each_entry_continue_reverse(p, &br->port_list, list) {
                vg = nbp_vlan_group(p);
-               list_for_each_entry(vlan, &vg->vlan_list, vlist)
+               list_for_each_entry(vlan, &vg->vlan_list, vlist) {
+                       if (vlan->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV)
+                               continue;
                        vlan_vid_del(p->dev, proto, vlan->vid);
+               }
        }
 
        return err;
@@ -2105,7 +2116,8 @@ static int br_vlan_rtm_dump(struct sk_buff *skb, struct netlink_callback *cb)
                        goto out_err;
                }
                err = br_vlan_dump_dev(dev, skb, cb, dump_flags);
-               if (err && err != -EMSGSIZE)
+               /* if the dump completed without an error we return 0 here */
+               if (err != -EMSGSIZE)
                        goto out_err;
        } else {
                for_each_netdev_rcu(net, dev) {