public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn•fujitsu.com>
To: yoshfuji@linux-ipv6•org
Cc: netdev@vger•kernel.org, davem@sunset•davemloft.net
Subject: [PATCH] IPv6: Fix the data length of get destination options with short length
Date: Wed, 28 May 2008 15:15:27 +0800	[thread overview]
Message-ID: <483D068F.8050201@cn.fujitsu.com> (raw)

 If get destination options with length which is not enough for that
option,getsockopt() will still return the real length of the option,
which is larger then the buffer space.
 This is because ipv6_getsockopt_sticky() returns the real length of
the option.

This patch fix this problem.

Signed-off-by: Yang Hongyang <yaonghy@cn•fujitsu.cm> 

--- a/net/ipv6/ipv6_sockglue.c	2008-05-28 09:17:14.000000000 +0800
+++ b/net/ipv6/ipv6_sockglue.c	2008-05-28 12:41:01.000000000 +0800
@@ -832,7 +832,7 @@ static int ipv6_getsockopt_sticky(struct
 	len = min_t(unsigned int, len, ipv6_optlen(hdr));
 	if (copy_to_user(optval, hdr, len))
 		return -EFAULT;
-	return ipv6_optlen(hdr);
+	return len;
 }
 



             reply	other threads:[~2008-05-28  7:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28  7:15 Yang Hongyang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-28  6:49 [PATCH] IPv6: Fix the data length of get destination options with short length Yang Hongyang
2008-05-28  6:54 ` Wang Chen
2008-05-28  7:06   ` Yang Hongyang
2008-05-28 11:13 ` YOSHIFUJI Hideaki / 吉藤英明
2008-05-29  1:29   ` Yang Hongyang
2008-05-29  2:29   ` Yang Hongyang
2008-05-29  8:42     ` YOSHIFUJI Hideaki / 吉藤英明

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=483D068F.8050201@cn.fujitsu.com \
    --to=yanghy@cn$(echo .)fujitsu.com \
    --cc=davem@sunset$(echo .)davemloft.net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=yoshfuji@linux-ipv6$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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