* [PATCH 1/2] IPv6: Fix the return value of get destination options with NULL data pointer
@ 2008-05-28 8:23 Yang Hongyang
2008-05-28 12:07 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 2+ messages in thread
From: Yang Hongyang @ 2008-05-28 8:23 UTC (permalink / raw)
To: yoshfuji; +Cc: davem, netdev
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>
---
net/ipv6/ipv6_sockglue.c | 3 +++
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);
}
-- 1.5.3.8
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/2] IPv6: Fix the return value of get destination options with NULL data pointer
2008-05-28 8:23 [PATCH 1/2] IPv6: Fix the return value of get destination options with NULL data pointer Yang Hongyang
@ 2008-05-28 12:07 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-05-28 12:07 UTC (permalink / raw)
To: yanghy; +Cc: davem, netdev, yoshfuji
In article <483D1693.4080805@cn.fujitsu.com> (at Wed, 28 May 2008 16:23:47 +0800), Yang Hongyang <yanghy@cn.fujitsu.com> says:
> 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.
I'm going to apply this in my tree. Thanks.
--yoshfuji
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-28 12:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28 8:23 [PATCH 1/2] IPv6: Fix the return value of get destination options with NULL data pointer Yang Hongyang
2008-05-28 12:07 ` YOSHIFUJI Hideaki / 吉藤英明
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).