summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ipv6_sockglue.c
diff options
context:
space:
mode:
authorYang Hongyang <yanghy@cn.fujitsu.com>2008-05-28 16:23:47 +0800
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-06-05 04:02:34 +0900
commit05335c2220c4911b69cb1bdd79e603ab08088372 (patch)
treefadca5b01e5029eaef277f691c9f4d78a54c0bad /net/ipv6/ipv6_sockglue.c
parent4bed72e4f5502ea3322f0a00794815fa58951abe (diff)
downloadop-kernel-dev-05335c2220c4911b69cb1bdd79e603ab08088372.zip
op-kernel-dev-05335c2220c4911b69cb1bdd79e603ab08088372.tar.gz
[IPV6]: Fix the return value of get destination options with NULL data pointer
If we pass NULL data buffer to getsockopt(), it will return 0, and the option length is set to -EFAULT: getsockopt(sk, IPPROTO_IPV6, IPV6_DSTOPTS, NULL, &len); This is because ipv6_getsockopt_sticky() will return -EFAULT or -EINVAL if some error occur. This patch fix this problem. Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/ipv6_sockglue.c')
-rw-r--r--net/ipv6/ipv6_sockglue.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 56d55fe..aa7bedf 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -975,6 +975,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
len = ipv6_getsockopt_sticky(sk, np->opt,
optname, optval, len);
release_sock(sk);
+ /* check if ipv6_getsockopt_sticky() returns err code */
+ if (len < 0)
+ return len;
return put_user(len, optlen);
}
OpenPOWER on IntegriCloud