netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6 PATCH] IPV6: Check length of optval provided by user in setsockopt()
@ 2008-03-31  9:08 Wang Chen
  2008-03-31  9:15 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 7+ messages in thread
From: Wang Chen @ 2008-03-31  9:08 UTC (permalink / raw)
  To: David S. Miller, YOSHIFUJI Hideaki; +Cc: NETDEV

Check length of setsockopt's optval, which provided by user, before copy it
from user space.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 net/ipv6/ipv6_sockglue.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index bf2a686..1ad0ac9 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -557,6 +557,9 @@ done:
 	{
 		struct ipv6_mreq mreq;
 
+		if (optlen != sizeof(struct ipv6_mreq))
+			goto e_inval;
+
 		retv = -EPROTO;
 		if (inet_sk(sk)->is_icsk)
 			break;
@@ -595,6 +598,9 @@ done:
 		struct group_req greq;
 		struct sockaddr_in6 *psin6;
 
+		if (optlen != sizeof(struct group_req))
+			goto e_inval;
+
 		retv = -EFAULT;
 		if (copy_from_user(&greq, optval, sizeof(struct group_req)))
 			break;
-- 
1.5.3.4



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

end of thread, other threads:[~2008-04-11  7:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31  9:08 [2.6 PATCH] IPV6: Check length of optval provided by user in setsockopt() Wang Chen
2008-03-31  9:15 ` YOSHIFUJI Hideaki / 吉藤英明
2008-03-31 10:46   ` Wang Chen
2008-03-31 10:53     ` YOSHIFUJI Hideaki / 吉藤英明
2008-03-31 11:04       ` Wang Chen
2008-04-07  1:42       ` Wang Chen
2008-04-11  7:15         ` 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).