[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <488D32EB.4@cn.fujitsu.com>
Date: Mon, 28 Jul 2008 10:46:03 +0800
From: Yang Hongyang <yanghy@...fujitsu.com>
To: David Miller <davem@...emloft.net>
CC: netdev@...r.kernel.org
Subject: [PATCH] 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@...fujitsu.com>
---
ipv6_sockglue.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ipv6_sockglue.c b/ipv6_sockglue.c
index ea33b26..2cabac9 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;
--
1.5.3.8
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists