summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-07-18 02:07:51 -0700
committerDavid S. Miller <davem@davemloft.net>2007-07-18 02:07:51 -0700
commiteb4965344965530411359891214cd6fcab483649 (patch)
treed6007042cd1ca2ac1f2378ea93ce3878bec89d0b /net
parentf77ae9390438409b535f3b1854672e54120cd38b (diff)
downloadlinux-3.10-eb4965344965530411359891214cd6fcab483649.tar.gz
linux-3.10-eb4965344965530411359891214cd6fcab483649.tar.bz2
linux-3.10-eb4965344965530411359891214cd6fcab483649.zip
[NETLINK]: negative groups in netlink_setsockopt
Reading netlink_setsockopt it's not immediately clear why there isn't a bug when you pass in negative numbers, the reason being that the >= comparison is really unsigned although 'val' is signed because nlk->ngroups is unsigned. Make 'val' unsigned too. [ Update the get_user() cast to match. --DaveM ] Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a3c8e692f49..641cfbc278d 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1012,13 +1012,14 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
- int val = 0, err;
+ unsigned int val = 0;
+ int err;
if (level != SOL_NETLINK)
return -ENOPROTOOPT;
if (optlen >= sizeof(int) &&
- get_user(val, (int __user *)optval))
+ get_user(val, (unsigned int __user *)optval))
return -EFAULT;
switch (optname) {