summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorDavid S. Miller2012-04-02 02:27:33 +0200
committerDavid S. Miller2012-04-02 10:33:43 +0200
commitc78679e8f31b86c7a46e77a3096011f911854187 (patch)
tree511b7a8e07c89a6ca7936c1ed3cb26300d8fe6a5 /net/ipv6/ndisc.c
parentteam: Stop using NLA_PUT*(). (diff)
downloadkernel-qcow2-linux-c78679e8f31b86c7a46e77a3096011f911854187.tar.gz
kernel-qcow2-linux-c78679e8f31b86c7a46e77a3096011f911854187.tar.xz
kernel-qcow2-linux-c78679e8f31b86c7a46e77a3096011f911854187.zip
ipv6: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 3dcdb81ec3e8..1d6fb0c94da1 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1099,8 +1099,9 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
memcpy(ndmsg + 1, opt, opt->nd_opt_len << 3);
- NLA_PUT(skb, NDUSEROPT_SRCADDR, sizeof(struct in6_addr),
- &ipv6_hdr(ra)->saddr);
+ if (nla_put(skb, NDUSEROPT_SRCADDR, sizeof(struct in6_addr),
+ &ipv6_hdr(ra)->saddr))
+ goto nla_put_failure;
nlmsg_end(skb, nlh);
rtnl_notify(skb, net, 0, RTNLGRP_ND_USEROPT, NULL, GFP_ATOMIC);