Commit 43ab8502 authored by roel kluin's avatar roel kluin Committed by David S. Miller

ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl()

struct ax25_ctl_struct member `arg' is unsigned and cannot be less
than 0.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac958154
...@@ -369,6 +369,9 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) ...@@ -369,6 +369,9 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
if (ax25_ctl.digi_count > AX25_MAX_DIGIS) if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
return -EINVAL; return -EINVAL;
if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
return -EINVAL;
digi.ndigi = ax25_ctl.digi_count; digi.ndigi = ax25_ctl.digi_count;
for (k = 0; k < digi.ndigi; k++) for (k = 0; k < digi.ndigi; k++)
digi.calls[k] = ax25_ctl.digi_addr[k]; digi.calls[k] = ax25_ctl.digi_addr[k];
...@@ -418,14 +421,10 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) ...@@ -418,14 +421,10 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
break; break;
case AX25_T3: case AX25_T3:
if (ax25_ctl.arg < 0)
goto einval_put;
ax25->t3 = ax25_ctl.arg * HZ; ax25->t3 = ax25_ctl.arg * HZ;
break; break;
case AX25_IDLE: case AX25_IDLE:
if (ax25_ctl.arg < 0)
goto einval_put;
ax25->idle = ax25_ctl.arg * 60 * HZ; ax25->idle = ax25_ctl.arg * 60 * HZ;
break; break;
......
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