aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-10-14 01:26:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-30 02:06:39 -0400
commit43ab85021e8286e1641928ab3cc542dd1e8c7f94 (patch)
tree91a933de6faa4fb6db27bea699faa78357d8a25e
parentac958154e9e1548933fe97e4ecbceb30e01e4a6f (diff)
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: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ax25/af_ax25.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index f05306f168fa..f1e998b2796e 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -369,6 +369,9 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
369 if (ax25_ctl.digi_count > AX25_MAX_DIGIS) 369 if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
370 return -EINVAL; 370 return -EINVAL;
371 371
372 if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
373 return -EINVAL;
374
372 digi.ndigi = ax25_ctl.digi_count; 375 digi.ndigi = ax25_ctl.digi_count;
373 for (k = 0; k < digi.ndigi; k++) 376 for (k = 0; k < digi.ndigi; k++)
374 digi.calls[k] = ax25_ctl.digi_addr[k]; 377 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 break; 421 break;
419 422
420 case AX25_T3: 423 case AX25_T3:
421 if (ax25_ctl.arg < 0)
422 goto einval_put;
423 ax25->t3 = ax25_ctl.arg * HZ; 424 ax25->t3 = ax25_ctl.arg * HZ;
424 break; 425 break;
425 426
426 case AX25_IDLE: 427 case AX25_IDLE:
427 if (ax25_ctl.arg < 0)
428 goto einval_put;
429 ax25->idle = ax25_ctl.arg * 60 * HZ; 428 ax25->idle = ax25_ctl.arg * 60 * HZ;
430 break; 429 break;
431 430