diff options
Diffstat (limited to 'net/mpls/af_mpls.c')
-rw-r--r-- | net/mpls/af_mpls.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index bdcfb2d04cd2..ea4f481839dd 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c | |||
@@ -2076,6 +2076,7 @@ static int mpls_getroute(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, | |||
2076 | { | 2076 | { |
2077 | struct net *net = sock_net(in_skb->sk); | 2077 | struct net *net = sock_net(in_skb->sk); |
2078 | u32 portid = NETLINK_CB(in_skb).portid; | 2078 | u32 portid = NETLINK_CB(in_skb).portid; |
2079 | u32 in_label = LABEL_NOT_SPECIFIED; | ||
2079 | struct nlattr *tb[RTA_MAX + 1]; | 2080 | struct nlattr *tb[RTA_MAX + 1]; |
2080 | u32 labels[MAX_NEW_LABELS]; | 2081 | u32 labels[MAX_NEW_LABELS]; |
2081 | struct mpls_shim_hdr *hdr; | 2082 | struct mpls_shim_hdr *hdr; |
@@ -2086,9 +2087,8 @@ static int mpls_getroute(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, | |||
2086 | struct nlmsghdr *nlh; | 2087 | struct nlmsghdr *nlh; |
2087 | struct sk_buff *skb; | 2088 | struct sk_buff *skb; |
2088 | struct mpls_nh *nh; | 2089 | struct mpls_nh *nh; |
2089 | int err = -EINVAL; | ||
2090 | u32 in_label; | ||
2091 | u8 n_labels; | 2090 | u8 n_labels; |
2091 | int err; | ||
2092 | 2092 | ||
2093 | err = nlmsg_parse(in_nlh, sizeof(*rtm), tb, RTA_MAX, | 2093 | err = nlmsg_parse(in_nlh, sizeof(*rtm), tb, RTA_MAX, |
2094 | rtm_mpls_policy, extack); | 2094 | rtm_mpls_policy, extack); |
@@ -2101,11 +2101,15 @@ static int mpls_getroute(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, | |||
2101 | u8 label_count; | 2101 | u8 label_count; |
2102 | 2102 | ||
2103 | if (nla_get_labels(tb[RTA_DST], 1, &label_count, | 2103 | if (nla_get_labels(tb[RTA_DST], 1, &label_count, |
2104 | &in_label, extack)) | 2104 | &in_label, extack)) { |
2105 | err = -EINVAL; | ||
2105 | goto errout; | 2106 | goto errout; |
2107 | } | ||
2106 | 2108 | ||
2107 | if (in_label < MPLS_LABEL_FIRST_UNRESERVED) | 2109 | if (!mpls_label_ok(net, in_label, extack)) { |
2110 | err = -EINVAL; | ||
2108 | goto errout; | 2111 | goto errout; |
2112 | } | ||
2109 | } | 2113 | } |
2110 | 2114 | ||
2111 | rt = mpls_route_input_rcu(net, in_label); | 2115 | rt = mpls_route_input_rcu(net, in_label); |