lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <48BE4DA2.20800@cn.fujitsu.com>
Date:	Wed, 03 Sep 2008 16:41:06 +0800
From:	Shan Wei <shanwei@...fujitsu.com>
To:	davem@...emloft.net
CC:	netdev@...r.kernel.org
Subject: [PATCH RESEND] ipv6: return with appropriate error code when sending
 RH0 using setsockopt()

 I'm sorry to resend the patch, for that no one replied it from Jun 27.

 The kernel had removed the RH0(Type 0 Routing Header), but we can still
 send IPv6 packet with RH0 using sendmsg() or setsockopt().

 Compare with sendmsg() that returns EINVAL, but setsockopt() return EPERM.
 The patch fix it.

Signed-off-by: Shan Wei <shanwei@...fujitsu.com>
---
 net/ipv6/ipv6_sockglue.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 4e5eac3..7a58597 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -353,9 +353,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 			goto e_inval;
 
 		/* hop-by-hop / destination options are privileged option */
-		retv = -EPERM;
-		if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW))
+		if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) {
+			retv = -EPERM;
 			break;
+		}
 
 		opt = ipv6_renew_options(sk, np->opt, optname,
 					 (struct ipv6_opt_hdr __user *)optval,
@@ -365,6 +366,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 			break;
 		}
 
+		retv = -EINVAL;
 		/* routing header option needs extra check */
 		if (optname == IPV6_RTHDR && opt && opt->srcrt) {
 			struct ipv6_rt_hdr *rthdr = opt->srcrt;
-- 
1.6.0


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ