Commit a4056573 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-2.6-misc-20080611a' of git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-fix

parents 5cb960a8 1717699c
...@@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net, ...@@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net,
} }
*hlimit = *(int *)CMSG_DATA(cmsg); *hlimit = *(int *)CMSG_DATA(cmsg);
if (*hlimit < -1 || *hlimit > 0xff) {
err = -EINVAL;
goto exit_f;
}
break; break;
case IPV6_TCLASS: case IPV6_TCLASS:
......
...@@ -67,7 +67,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *)) ...@@ -67,7 +67,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *))
/* RA packet may be delivered ONLY to IPPROTO_RAW socket */ /* RA packet may be delivered ONLY to IPPROTO_RAW socket */
if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW)
return -EINVAL; return -ENOPROTOOPT;
new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
...@@ -446,7 +446,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -446,7 +446,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
case IPV6_MULTICAST_HOPS: case IPV6_MULTICAST_HOPS:
if (sk->sk_type == SOCK_STREAM) if (sk->sk_type == SOCK_STREAM)
goto e_inval; break;
if (optlen < sizeof(int)) if (optlen < sizeof(int))
goto e_inval; goto e_inval;
if (val > 255 || val < -1) if (val > 255 || val < -1)
...@@ -458,13 +458,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -458,13 +458,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
case IPV6_MULTICAST_LOOP: case IPV6_MULTICAST_LOOP:
if (optlen < sizeof(int)) if (optlen < sizeof(int))
goto e_inval; goto e_inval;
if (val != valbool)
goto e_inval;
np->mc_loop = valbool; np->mc_loop = valbool;
retv = 0; retv = 0;
break; break;
case IPV6_MULTICAST_IF: case IPV6_MULTICAST_IF:
if (sk->sk_type == SOCK_STREAM) if (sk->sk_type == SOCK_STREAM)
goto e_inval; break;
if (optlen < sizeof(int)) if (optlen < sizeof(int))
goto e_inval; goto e_inval;
...@@ -860,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -860,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
if (sk->sk_protocol != IPPROTO_UDP && if (sk->sk_protocol != IPPROTO_UDP &&
sk->sk_protocol != IPPROTO_UDPLITE && sk->sk_protocol != IPPROTO_UDPLITE &&
sk->sk_protocol != IPPROTO_TCP) sk->sk_protocol != IPPROTO_TCP)
return -EINVAL; return -ENOPROTOOPT;
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN; return -ENOTCONN;
val = sk->sk_family; val = sk->sk_family;
...@@ -874,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -874,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
return -EINVAL; return -EINVAL;
if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0)))
return -EFAULT; return -EFAULT;
if (gsf.gf_group.ss_family != AF_INET6)
return -EADDRNOTAVAIL;
lock_sock(sk); lock_sock(sk);
err = ip6_mc_msfget(sk, &gsf, err = ip6_mc_msfget(sk, &gsf,
(struct group_filter __user *)optval, optlen); (struct group_filter __user *)optval, optlen);
......
...@@ -2196,8 +2196,12 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, ...@@ -2196,8 +2196,12 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric);
expires = (rt->rt6i_flags & RTF_EXPIRES) ? if (!(rt->rt6i_flags & RTF_EXPIRES))
rt->rt6i_expires - jiffies : 0; expires = 0;
else if (rt->rt6i_expires - jiffies < INT_MAX)
expires = rt->rt6i_expires - jiffies;
else
expires = INT_MAX;
if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0,
expires, rt->u.dst.error) < 0) expires, rt->u.dst.error) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment