Skip to contentSkip to conversation

IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer

PATCH Applied Yang Hongyang 2 participants 2 messages Jul 28, 2008 – Aug 4, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer

Please ingnore prev one.

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.

---
 ipv6_sockglue.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv6/ipv6_sockglue.c +2 -0
index ea33b26..2cabac9 100644
@@ -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;
Signature · 20 lines
1.5.3.8 

-- 
Regards
Yang Hongyang
 
A new email address of FJWAN is launched from Apr.1 2007.
The updated address is: [email protected]
--------------------------------------------------
Yang Hongyang
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
8/F., Civil Defense Building, No.189 Guangzhou Road,
Nanjing, 210029, China
TEL: +86+25-86630566-812
FUJITSU INTERNAL: 79955-812
FAX: +86+25-83317685
EMAIL: [email protected]
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not an intended recipient of this communication, you are hereby notified that any dissemination, distribution or copying hereof is strictly prohibited.  If you have received this communication in error, please notify me by reply e-mail, permanently delete this communication from your system, and destroy any hard copies you may have printed
maintainer Applied
#1 lore raw

From: Yang Hongyang <[email protected]>
Date: Mon, 28 Jul 2008 10:56:35 +0800

Quoted 8 lines

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.

Applied, thanks!