]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/core/rtnetlink.c
Merge tag 'riscv-for-linus-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel...
[linux.git] / net / core / rtnetlink.c
index 0958c7be2c22cd37c5992ece4bff5e888cb762d1..33d9227a8b8077a8cf6edbcaaa9f5b92d4fee48e 100644 (file)
@@ -3333,6 +3333,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
        int idx;
        int s_idx = cb->family;
        int type = cb->nlh->nlmsg_type - RTM_BASE;
+       int ret = 0;
 
        if (s_idx == 0)
                s_idx = 1;
@@ -3365,12 +3366,13 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
                        cb->prev_seq = 0;
                        cb->seq = 0;
                }
-               if (dumpit(skb, cb))
+               ret = dumpit(skb, cb);
+               if (ret)
                        break;
        }
        cb->family = idx;
 
-       return skb->len;
+       return skb->len ? : ret;
 }
 
 struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
@@ -3598,6 +3600,11 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
                return -EINVAL;
        }
 
+       if (dev->type != ARPHRD_ETHER) {
+               NL_SET_ERR_MSG(extack, "FDB add only supported for Ethernet devices");
+               return -EINVAL;
+       }
+
        addr = nla_data(tb[NDA_LLADDR]);
 
        err = fdb_vid_parse(tb[NDA_VLAN], &vid, extack);
@@ -3702,6 +3709,11 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
                return -EINVAL;
        }
 
+       if (dev->type != ARPHRD_ETHER) {
+               NL_SET_ERR_MSG(extack, "FDB delete only supported for Ethernet devices");
+               return -EINVAL;
+       }
+
        addr = nla_data(tb[NDA_LLADDR]);
 
        err = fdb_vid_parse(tb[NDA_VLAN], &vid, extack);