Commit ea7a8085 authored by David Ahern's avatar David Ahern Committed by David S. Miller

net: lwtunnel: Handle lwtunnel_fill_encap failure

Handle failure in lwtunnel_fill_encap adding attributes to skb.

Fixes: 571e7226 ("ipv4: support for fib route lwtunnel encap attributes")
Fixes: 19e42e45 ("ipv6: support for fib route lwtunnel encap attributes")
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18a3ed59
...@@ -1279,8 +1279,9 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, ...@@ -1279,8 +1279,9 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
nla_put_u32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid)) nla_put_u32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid))
goto nla_put_failure; goto nla_put_failure;
#endif #endif
if (fi->fib_nh->nh_lwtstate) if (fi->fib_nh->nh_lwtstate &&
lwtunnel_fill_encap(skb, fi->fib_nh->nh_lwtstate); lwtunnel_fill_encap(skb, fi->fib_nh->nh_lwtstate) < 0)
goto nla_put_failure;
} }
#ifdef CONFIG_IP_ROUTE_MULTIPATH #ifdef CONFIG_IP_ROUTE_MULTIPATH
if (fi->fib_nhs > 1) { if (fi->fib_nhs > 1) {
...@@ -1316,8 +1317,10 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, ...@@ -1316,8 +1317,10 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid))
goto nla_put_failure; goto nla_put_failure;
#endif #endif
if (nh->nh_lwtstate) if (nh->nh_lwtstate &&
lwtunnel_fill_encap(skb, nh->nh_lwtstate); lwtunnel_fill_encap(skb, nh->nh_lwtstate) < 0)
goto nla_put_failure;
/* length of rtnetlink header + attributes */ /* length of rtnetlink header + attributes */
rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh;
} endfor_nexthops(fi); } endfor_nexthops(fi);
......
...@@ -3317,7 +3317,8 @@ static int rt6_fill_node(struct net *net, ...@@ -3317,7 +3317,8 @@ static int rt6_fill_node(struct net *net,
if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt->rt6i_flags))) if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt->rt6i_flags)))
goto nla_put_failure; goto nla_put_failure;
lwtunnel_fill_encap(skb, rt->dst.lwtstate); if (lwtunnel_fill_encap(skb, rt->dst.lwtstate) < 0)
goto nla_put_failure;
nlmsg_end(skb, nlh); nlmsg_end(skb, nlh);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment