aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2017-05-08 05:57:13 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-08 15:10:31 -0400
commit8ed508fd4b84a38db63ddeee8ab6905f06cfa589 (patch)
tree847d7a2f96b86ba37fb51d44ef8b7d79b8de27a6
parent0d0e57697f162da4aa218b5feafe614fb666db07 (diff)
vti: check nla_put_* return value
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_vti.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 40977413fd48..4ec9affb2252 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -546,12 +546,13 @@ static int vti_fill_info(struct sk_buff *skb, const struct net_device *dev)
546 struct ip_tunnel *t = netdev_priv(dev); 546 struct ip_tunnel *t = netdev_priv(dev);
547 struct ip_tunnel_parm *p = &t->parms; 547 struct ip_tunnel_parm *p = &t->parms;
548 548
549 nla_put_u32(skb, IFLA_VTI_LINK, p->link); 549 if (nla_put_u32(skb, IFLA_VTI_LINK, p->link) ||
550 nla_put_be32(skb, IFLA_VTI_IKEY, p->i_key); 550 nla_put_be32(skb, IFLA_VTI_IKEY, p->i_key) ||
551 nla_put_be32(skb, IFLA_VTI_OKEY, p->o_key); 551 nla_put_be32(skb, IFLA_VTI_OKEY, p->o_key) ||
552 nla_put_in_addr(skb, IFLA_VTI_LOCAL, p->iph.saddr); 552 nla_put_in_addr(skb, IFLA_VTI_LOCAL, p->iph.saddr) ||
553 nla_put_in_addr(skb, IFLA_VTI_REMOTE, p->iph.daddr); 553 nla_put_in_addr(skb, IFLA_VTI_REMOTE, p->iph.daddr) ||
554 nla_put_u32(skb, IFLA_VTI_FWMARK, t->fwmark); 554 nla_put_u32(skb, IFLA_VTI_FWMARK, t->fwmark))
555 return -EMSGSIZE;
555 556
556 return 0; 557 return 0;
557} 558}