diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2017-01-11 17:29:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-12 15:11:43 -0500 |
commit | ea7a80858f57d8878b1499ea0f1b8a635cc48de7 (patch) | |
tree | 5befd248f3af2f3a74bcaa7f4a4d2117f9c6a5fe | |
parent | 18a3ed59d09cf81a6447aadf6931bf0c9ffec5e0 (diff) |
net: lwtunnel: Handle lwtunnel_fill_encap failure
Handle failure in lwtunnel_fill_encap adding attributes to skb.
Fixes: 571e722676fe ("ipv4: support for fib route lwtunnel encap attributes")
Fixes: 19e42e451506 ("ipv6: support for fib route lwtunnel encap attributes")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/fib_semantics.c | 11 | ||||
-rw-r--r-- | net/ipv6/route.c | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index eba1546b5031..9a375b908d01 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1279,8 +1279,9 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1279 | nla_put_u32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid)) | 1279 | nla_put_u32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid)) |
1280 | goto nla_put_failure; | 1280 | goto nla_put_failure; |
1281 | #endif | 1281 | #endif |
1282 | if (fi->fib_nh->nh_lwtstate) | 1282 | if (fi->fib_nh->nh_lwtstate && |
1283 | lwtunnel_fill_encap(skb, fi->fib_nh->nh_lwtstate); | 1283 | lwtunnel_fill_encap(skb, fi->fib_nh->nh_lwtstate) < 0) |
1284 | goto nla_put_failure; | ||
1284 | } | 1285 | } |
1285 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 1286 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
1286 | if (fi->fib_nhs > 1) { | 1287 | if (fi->fib_nhs > 1) { |
@@ -1316,8 +1317,10 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1316 | nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) | 1317 | nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) |
1317 | goto nla_put_failure; | 1318 | goto nla_put_failure; |
1318 | #endif | 1319 | #endif |
1319 | if (nh->nh_lwtstate) | 1320 | if (nh->nh_lwtstate && |
1320 | lwtunnel_fill_encap(skb, nh->nh_lwtstate); | 1321 | lwtunnel_fill_encap(skb, nh->nh_lwtstate) < 0) |
1322 | goto nla_put_failure; | ||
1323 | |||
1321 | /* length of rtnetlink header + attributes */ | 1324 | /* length of rtnetlink header + attributes */ |
1322 | rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; | 1325 | rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; |
1323 | } endfor_nexthops(fi); | 1326 | } endfor_nexthops(fi); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ce5aaf448c54..4f6b067c8753 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -3317,7 +3317,8 @@ static int rt6_fill_node(struct net *net, | |||
3317 | if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt->rt6i_flags))) | 3317 | if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt->rt6i_flags))) |
3318 | goto nla_put_failure; | 3318 | goto nla_put_failure; |
3319 | 3319 | ||
3320 | lwtunnel_fill_encap(skb, rt->dst.lwtstate); | 3320 | if (lwtunnel_fill_encap(skb, rt->dst.lwtstate) < 0) |
3321 | goto nla_put_failure; | ||
3321 | 3322 | ||
3322 | nlmsg_end(skb, nlh); | 3323 | nlmsg_end(skb, nlh); |
3323 | return 0; | 3324 | return 0; |