Commit 03f52a0a authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

ip6mr: Add sizeof verification to MRT6_ASSERT and MT6_PIM

Verify the length of the user-space arguments.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c91f6df2
...@@ -1646,6 +1646,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns ...@@ -1646,6 +1646,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
case MRT6_ASSERT: case MRT6_ASSERT:
{ {
int v; int v;
if (optlen != sizeof(v))
return -EINVAL;
if (get_user(v, (int __user *)optval)) if (get_user(v, (int __user *)optval))
return -EFAULT; return -EFAULT;
mrt->mroute_do_assert = v; mrt->mroute_do_assert = v;
...@@ -1656,6 +1659,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns ...@@ -1656,6 +1659,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
case MRT6_PIM: case MRT6_PIM:
{ {
int v; int v;
if (optlen != sizeof(v))
return -EINVAL;
if (get_user(v, (int __user *)optval)) if (get_user(v, (int __user *)optval))
return -EFAULT; return -EFAULT;
v = !!v; v = !!v;
......
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