diff options
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a6882686ca3a..b9b7dfaf202b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2685,13 +2685,20 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
2685 | int idx = 0; | 2685 | int idx = 0; |
2686 | u32 portid = NETLINK_CB(cb->skb).portid; | 2686 | u32 portid = NETLINK_CB(cb->skb).portid; |
2687 | u32 seq = cb->nlh->nlmsg_seq; | 2687 | u32 seq = cb->nlh->nlmsg_seq; |
2688 | struct nlattr *extfilt; | ||
2689 | u32 filter_mask = 0; | 2688 | u32 filter_mask = 0; |
2690 | 2689 | ||
2691 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), | 2690 | if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { |
2692 | IFLA_EXT_MASK); | 2691 | struct nlattr *extfilt; |
2693 | if (extfilt) | 2692 | |
2694 | filter_mask = nla_get_u32(extfilt); | 2693 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), |
2694 | IFLA_EXT_MASK); | ||
2695 | if (extfilt) { | ||
2696 | if (nla_len(extfilt) < sizeof(filter_mask)) | ||
2697 | return -EINVAL; | ||
2698 | |||
2699 | filter_mask = nla_get_u32(extfilt); | ||
2700 | } | ||
2701 | } | ||
2695 | 2702 | ||
2696 | rcu_read_lock(); | 2703 | rcu_read_lock(); |
2697 | for_each_netdev_rcu(net, dev) { | 2704 | for_each_netdev_rcu(net, dev) { |
@@ -2798,6 +2805,9 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2798 | if (br_spec) { | 2805 | if (br_spec) { |
2799 | nla_for_each_nested(attr, br_spec, rem) { | 2806 | nla_for_each_nested(attr, br_spec, rem) { |
2800 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { | 2807 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { |
2808 | if (nla_len(attr) < sizeof(flags)) | ||
2809 | return -EINVAL; | ||
2810 | |||
2801 | have_flags = true; | 2811 | have_flags = true; |
2802 | flags = nla_get_u16(attr); | 2812 | flags = nla_get_u16(attr); |
2803 | break; | 2813 | break; |
@@ -2868,6 +2878,9 @@ static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2868 | if (br_spec) { | 2878 | if (br_spec) { |
2869 | nla_for_each_nested(attr, br_spec, rem) { | 2879 | nla_for_each_nested(attr, br_spec, rem) { |
2870 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { | 2880 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { |
2881 | if (nla_len(attr) < sizeof(flags)) | ||
2882 | return -EINVAL; | ||
2883 | |||
2871 | have_flags = true; | 2884 | have_flags = true; |
2872 | flags = nla_get_u16(attr); | 2885 | flags = nla_get_u16(attr); |
2873 | break; | 2886 | break; |