Skip to content

Commit

Permalink
ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl()
Browse files Browse the repository at this point in the history
struct ax25_ctl_struct member `arg' is unsigned and cannot be less
than 0.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
RoelKluin authored and davem330 committed Oct 30, 2009
1 parent ac95815 commit 43ab850
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/ax25/af_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
return -EINVAL;

if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
return -EINVAL;

digi.ndigi = ax25_ctl.digi_count;
for (k = 0; k < digi.ndigi; k++)
digi.calls[k] = ax25_ctl.digi_addr[k];
Expand Down Expand Up @@ -418,14 +421,10 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
break;

case AX25_T3:
if (ax25_ctl.arg < 0)
goto einval_put;
ax25->t3 = ax25_ctl.arg * HZ;
break;

case AX25_IDLE:
if (ax25_ctl.arg < 0)
goto einval_put;
ax25->idle = ax25_ctl.arg * 60 * HZ;
break;

Expand Down

0 comments on commit 43ab850

Please sign in to comment.