diff options
author | Yang Hongyang <yanghy@cn.fujitsu.com> | 2008-08-04 05:16:15 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-04 05:16:15 +0400 |
commit | cfb266c0ee0ea0b7bfa8189e3a3a80344dec6112 (patch) | |
tree | 89989c670a92740f511486dd60e5aa14397d44b1 /net/ipv6 | |
parent | 1730554f253deb65fe5112c54b2f898d5318a328 (diff) | |
download | linux-cfb266c0ee0ea0b7bfa8189e3a3a80344dec6112.tar.xz |
ipv6: Fix the return value of Set Hop-by-Hop options header with NULL data pointer
When Set Hop-by-Hop options header with NULL data
pointer and optlen is not zero use setsockopt(),
the kernel successfully return 0 instead of
return error EINVAL or EFAULT.
This patch fix the problem.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index ea33b26512c2..741cfcd96f88 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -346,6 +346,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, */ if (optlen == 0) optval = NULL; + else if (optval == NULL) + goto e_inval; else if (optlen < sizeof(struct ipv6_opt_hdr) || optlen & 0x7 || optlen > 8 * 255) goto e_inval; |