summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6mr.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-11-25 19:26:34 +0100
committerDavid S. Miller <davem@davemloft.net>2012-11-26 23:35:58 +0100
commit03f52a0a554210d5049eeed9f1bb29047dc807cb (patch)
tree8bbbc7f22f5a124f340676281ce0901c179e412f /net/ipv6/ip6mr.c
parentsockopt: Change getsockopt() of SO_BINDTODEVICE to return an interface name (diff)
downloadlinux-03f52a0a554210d5049eeed9f1bb29047dc807cb.tar.xz
linux-03f52a0a554210d5049eeed9f1bb29047dc807cb.zip
ip6mr: Add sizeof verification to MRT6_ASSERT and MT6_PIM
Verify the length of the user-space arguments. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6mr.c')
-rw-r--r--net/ipv6/ip6mr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 79bb49061ef6..926ea544f499 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1646,6 +1646,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
case MRT6_ASSERT:
{
int v;
+
+ if (optlen != sizeof(v))
+ return -EINVAL;
if (get_user(v, (int __user *)optval))
return -EFAULT;
mrt->mroute_do_assert = v;
@@ -1656,6 +1659,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
case MRT6_PIM:
{
int v;
+
+ if (optlen != sizeof(v))
+ return -EINVAL;
if (get_user(v, (int __user *)optval))
return -EFAULT;
v = !!v;