Skip to content

Commit

Permalink
Merge branch 'net-2.6-misc-20080611a' of git://git.linux-ipv6.org/git…
Browse files Browse the repository at this point in the history
…root/yoshfuji/linux-2.6-fix
  • Loading branch information
David S. Miller committed Jun 12, 2008
2 parents 5cb960a + 1717699 commit a405657
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions net/ipv6/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net,
}

*hlimit = *(int *)CMSG_DATA(cmsg);
if (*hlimit < -1 || *hlimit > 0xff) {
err = -EINVAL;
goto exit_f;
}

break;

case IPV6_TCLASS:
Expand Down
12 changes: 8 additions & 4 deletions net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
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;

Expand Down Expand Up @@ -446,7 +446,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,

case IPV6_MULTICAST_HOPS:
if (sk->sk_type == SOCK_STREAM)
goto e_inval;
break;
if (optlen < sizeof(int))
goto e_inval;
if (val > 255 || val < -1)
Expand All @@ -458,13 +458,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
case IPV6_MULTICAST_LOOP:
if (optlen < sizeof(int))
goto e_inval;
if (val != valbool)
goto e_inval;
np->mc_loop = valbool;
retv = 0;
break;

case IPV6_MULTICAST_IF:
if (sk->sk_type == SOCK_STREAM)
goto e_inval;
break;
if (optlen < sizeof(int))
goto e_inval;

Expand Down Expand Up @@ -860,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
if (sk->sk_protocol != IPPROTO_UDP &&
sk->sk_protocol != IPPROTO_UDPLITE &&
sk->sk_protocol != IPPROTO_TCP)
return -EINVAL;
return -ENOPROTOOPT;
if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN;
val = sk->sk_family;
Expand All @@ -874,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
return -EINVAL;
if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0)))
return -EFAULT;
if (gsf.gf_group.ss_family != AF_INET6)
return -EADDRNOTAVAIL;
lock_sock(sk);
err = ip6_mc_msfget(sk, &gsf,
(struct group_filter __user *)optval, optlen);
Expand Down
8 changes: 6 additions & 2 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

expires = (rt->rt6i_flags & RTF_EXPIRES) ?
rt->rt6i_expires - jiffies : 0;
if (!(rt->rt6i_flags & RTF_EXPIRES))
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,
expires, rt->u.dst.error) < 0)
Expand Down

0 comments on commit a405657

Please sign in to comment.