Commit 6a1015b0 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

ipv4: potential underflow in compat_ip_setsockopt()

The value of "n" is capped at 0x1ffffff but it checked for negative
values.  I don't think this causes a problem but I'm not certain and
it's harmless to prevent it.

Fixes: 2e041728 ("ipv4: do compat setsockopt for MCAST_MSFILTER directly")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca23cb0b
...@@ -1347,8 +1347,8 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname, ...@@ -1347,8 +1347,8 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
{ {
const int size0 = offsetof(struct compat_group_filter, gf_slist); const int size0 = offsetof(struct compat_group_filter, gf_slist);
struct compat_group_filter *gf32; struct compat_group_filter *gf32;
unsigned int n;
void *p; void *p;
int n;
if (optlen < size0) if (optlen < size0)
return -EINVAL; return -EINVAL;
......
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