netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer
  2008-07-22 21:29 ` [PATCH 3/5] ipv6: use spin_trylock_bh Stephen Hemminger
@ 2008-07-28  2:46   ` Yang Hongyang
  0 siblings, 0 replies; 3+ messages in thread
From: Yang Hongyang @ 2008-07-28  2:46 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer
@ 2008-07-28  2:56 Yang Hongyang
  2008-08-04  1:16 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Hongyang @ 2008-07-28  2:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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.

Signed-off-by: Yang Hongyang<yanghy@cn.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 

-- 
Regards
Yang Hongyang
 
A new email address of FJWAN is launched from Apr.1 2007.
The updated address is: yanghy@cn.fujitsu.com
--------------------------------------------------
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: yanghy@cn.fujitsu.com
--------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer
  2008-07-28  2:56 [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer Yang Hongyang
@ 2008-08-04  1:16 ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-08-04  1:16 UTC (permalink / raw)
  To: yanghy; +Cc: netdev

From: Yang Hongyang <yanghy@cn.fujitsu.com>
Date: Mon, 28 Jul 2008 10:56:35 +0800

> 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>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-04  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28  2:56 [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer Yang Hongyang
2008-08-04  1:16 ` David Miller
     [not found] <20080722212927.937523165@vyatta.com>
2008-07-22 21:29 ` [PATCH 3/5] ipv6: use spin_trylock_bh Stephen Hemminger
2008-07-28  2:46   ` [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer Yang Hongyang

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).