netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPv6: Fix the data length of get destination options with short length
@ 2008-05-28  7:15 Yang Hongyang
  0 siblings, 0 replies; 8+ messages in thread
From: Yang Hongyang @ 2008-05-28  7:15 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, davem

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



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH] IPv6: Fix the data length of get destination options with short length
@ 2008-05-28  6:49 Yang Hongyang
  2008-05-28  6:54 ` Wang Chen
  2008-05-28 11:13 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 8+ messages in thread
From: Yang Hongyang @ 2008-05-28  6:49 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, FNST-Wei Yongjun, Wang Chen, davem

  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 <yanghy@cn.fujitsu.com>

--- net/ipv6/ipv6_sockglue.c	2008-05-28 09:17:14.000000000 +0800
+++ 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;
 }

---------
2.6.26-rc4 



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

end of thread, other threads:[~2008-05-29  8:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28  7:15 [PATCH] IPv6: Fix the data length of get destination options with short length Yang Hongyang
  -- strict thread matches above, loose matches on Subject: below --
2008-05-28  6:49 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 / 吉藤英明

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