netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer
Date: Mon, 28 Jul 2008 10:46:03 +0800	[thread overview]
Message-ID: <488D32EB.4@cn.fujitsu.com> (raw)
In-Reply-To: <20080722212951.706497135@vyatta.com>

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

  parent reply	other threads:[~2008-07-28  2:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080722212927.937523165@vyatta.com>
2008-07-22 21:29 ` [PATCH 1/5] netns: dont alloc ipv6 fib timer list Stephen Hemminger
2008-07-22 21:33   ` David Miller
2008-07-22 21:29 ` [PATCH 2/5] ipv6: use round_jiffies Stephen Hemminger
2008-07-22 21:34   ` David Miller
2008-07-22 21:29 ` [PATCH 3/5] ipv6: use spin_trylock_bh Stephen Hemminger
2008-07-22 21:34   ` David Miller
2008-07-28  2:46   ` Yang Hongyang [this message]
2008-07-22 21:29 ` [PATCH 4/5] ipv6: use kcalloc Stephen Hemminger
2008-07-22 21:35   ` David Miller
2008-07-22 21:29 ` [PATCH 5/5] ipv6: icmp6_dst_gc return change Stephen Hemminger
2008-07-22 21:35   ` David Miller
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=488D32EB.4@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).