From 9c5454a4717116db9bd17f34b78726bde6fb4b15 Mon Sep 17 00:00:00 2001 From: Shan Wei Date: Thu, 19 Jun 2008 16:29:39 -0700 Subject: [PATCH] --- yaml --- r: 98363 b: refs/heads/master c: aea7427f70cce5fa8f99ce447b213e9e3b49f24c h: refs/heads/master i: 98361: 1c8ded95b47802472bcbb6c8a5f61a9ca00396e5 98359: 141e1489b26cbf9a0e7879c00bcf72ecffd5688e v: v3 --- [refs] | 2 +- trunk/net/ipv6/ipv6_sockglue.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 76a9832d8128..769bcdee5380 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ef3a62d272f033989e83eb1f26505f93f93e3e69 +refs/heads/master: aea7427f70cce5fa8f99ce447b213e9e3b49f24c diff --git a/trunk/net/ipv6/ipv6_sockglue.c b/trunk/net/ipv6/ipv6_sockglue.c index c042ce19bd14..86e28a75267f 100644 --- a/trunk/net/ipv6/ipv6_sockglue.c +++ b/trunk/net/ipv6/ipv6_sockglue.c @@ -345,18 +345,21 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, case IPV6_DSTOPTS: { struct ipv6_txoptions *opt; + + /* remove any sticky options header with a zero option + * length, per RFC3542. + */ if (optlen == 0) optval = NULL; + else if (optlen < sizeof(struct ipv6_opt_hdr) || + optlen & 0x7 || optlen > 8 * 255) + goto e_inval; /* hop-by-hop / destination options are privileged option */ retv = -EPERM; if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) break; - if (optlen < sizeof(struct ipv6_opt_hdr) || - optlen & 0x7 || optlen > 8 * 255) - goto e_inval; - opt = ipv6_renew_options(sk, np->opt, optname, (struct ipv6_opt_hdr __user *)optval, optlen);