]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vlan: vlan_changelink() should propagate errors
authorEric Dumazet <edumazet@google.com>
Tue, 7 Jan 2020 09:42:25 +0000 (01:42 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jan 2020 21:35:14 +0000 (13:35 -0800)
Both vlan_dev_change_flags() and vlan_dev_set_egress_priority()
can return an error. vlan_changelink() should not ignore them.

Fixes: 150606db5e80 ("[VLAN]: Use rtnl_link API")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/8021q/vlan_netlink.c

index b2a4b8b5a0cdffd41e785948f4d092dedd07a5b0..0db85aeb119b88fae1abaf7d0a10019ba4044915 100644 (file)
@@ -108,11 +108,13 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[],
        struct ifla_vlan_flags *flags;
        struct ifla_vlan_qos_mapping *m;
        struct nlattr *attr;
-       int rem;
+       int rem, err;
 
        if (data[IFLA_VLAN_FLAGS]) {
                flags = nla_data(data[IFLA_VLAN_FLAGS]);
-               vlan_dev_change_flags(dev, flags->flags, flags->mask);
+               err = vlan_dev_change_flags(dev, flags->flags, flags->mask);
+               if (err)
+                       return err;
        }
        if (data[IFLA_VLAN_INGRESS_QOS]) {
                nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) {
@@ -123,7 +125,9 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[],
        if (data[IFLA_VLAN_EGRESS_QOS]) {
                nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) {
                        m = nla_data(attr);
-                       vlan_dev_set_egress_priority(dev, m->from, m->to);
+                       err = vlan_dev_set_egress_priority(dev, m->from, m->to);
+                       if (err)
+                               return err;
                }
        }
        return 0;