diff options
author | David S. Miller <davem@davemloft.net> | 2009-09-30 19:12:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-30 19:12:20 -0400 |
commit | b7058842c940ad2c08dd829b21e5c92ebe3b8758 (patch) | |
tree | 5fe78d599fc345ca0bcd4b083b79095a54b2921b /net/ipv6/ipv6_sockglue.c | |
parent | eb1cf0f8f7a9e5a6d573d5bd72c015686a042db0 (diff) |
net: Make setsockopt() optlen be unsigned.
This provides safety against negative optlen at the type
level instead of depending upon (sometimes non-trivial)
checks against this sprinkled all over the the place, in
each and every implementation.
Based upon work done by Arjan van de Ven and feedback
from Linus Torvalds.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ipv6_sockglue.c')
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index f5e0682b402d..14f54eb5a7fc 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -123,7 +123,7 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk, | |||
123 | } | 123 | } |
124 | 124 | ||
125 | static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | 125 | static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
126 | char __user *optval, int optlen) | 126 | char __user *optval, unsigned int optlen) |
127 | { | 127 | { |
128 | struct ipv6_pinfo *np = inet6_sk(sk); | 128 | struct ipv6_pinfo *np = inet6_sk(sk); |
129 | struct net *net = sock_net(sk); | 129 | struct net *net = sock_net(sk); |
@@ -773,7 +773,7 @@ e_inval: | |||
773 | } | 773 | } |
774 | 774 | ||
775 | int ipv6_setsockopt(struct sock *sk, int level, int optname, | 775 | int ipv6_setsockopt(struct sock *sk, int level, int optname, |
776 | char __user *optval, int optlen) | 776 | char __user *optval, unsigned int optlen) |
777 | { | 777 | { |
778 | int err; | 778 | int err; |
779 | 779 | ||
@@ -801,7 +801,7 @@ EXPORT_SYMBOL(ipv6_setsockopt); | |||
801 | 801 | ||
802 | #ifdef CONFIG_COMPAT | 802 | #ifdef CONFIG_COMPAT |
803 | int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, | 803 | int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, |
804 | char __user *optval, int optlen) | 804 | char __user *optval, unsigned int optlen) |
805 | { | 805 | { |
806 | int err; | 806 | int err; |
807 | 807 | ||