From: walter harms <wharms@bfs.de>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: linux-hams@vger.kernel.org
Subject: Re: [PATCH] ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl()
Date: Mon, 12 Oct 2009 17:37:32 +0200 [thread overview]
Message-ID: <4AD34D3C.1060206@bfs.de> (raw)
In-Reply-To: <4AD0FB0B.8050609@gmail.com>
what is about something like:
tmp_arg=ax25_ctl.arg * HZ;
if (arg == 0 || arg > ULONG_MAX )
goto einval_put;
re,
wh
Roel Kluin schrieb:
> struct ax25_ctl_struct member `arg' is unsigned and cannot be less
> than 0.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> If the ax25_ctl.arg limit is known to be lower, please suggest
> other values.
>
> diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
> index f454607..0d99704 100644
> --- a/net/ax25/af_ax25.c
> +++ b/net/ax25/af_ax25.c
> @@ -398,14 +398,14 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
> break;
>
> case AX25_T1:
> - if (ax25_ctl.arg < 1)
> + if (ax25_ctl.arg < 1 || ax25_ctl.arg * HZ > ULONG_MAX)
> goto einval_put;
> ax25->rtt = (ax25_ctl.arg * HZ) / 2;
> ax25->t1 = ax25_ctl.arg * HZ;
> break;
>
> case AX25_T2:
> - if (ax25_ctl.arg < 1)
> + if (ax25_ctl.arg < 1 || ax25_ctl.arg * HZ > ULONG_MAX)
> goto einval_put;
> ax25->t2 = ax25_ctl.arg * HZ;
> break;
> @@ -418,13 +418,13 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
> break;
>
> case AX25_T3:
> - if (ax25_ctl.arg < 0)
> + if (ax25_ctl.arg * HZ > ULONG_MAX)
> goto einval_put;
> ax25->t3 = ax25_ctl.arg * HZ;
> break;
>
> case AX25_IDLE:
> - if (ax25_ctl.arg < 0)
> + if (ax25_ctl.arg * 60 * HZ > ULONG_MAX)
> goto einval_put;
> ax25->idle = ax25_ctl.arg * 60 * HZ;
> break;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hams" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2009-10-12 15:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-10 21:22 [PATCH] ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl() Roel Kluin
2009-10-12 15:37 ` walter harms [this message]
2009-10-12 19:02 ` Roel Kluin
2009-10-12 21:58 ` Kevin Dawson
2009-10-13 9:48 ` walter harms
2009-10-13 21:50 ` Kevin Dawson
2009-10-14 15:26 ` Roel Kluin
2009-10-30 6:06 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD34D3C.1060206@bfs.de \
--to=wharms@bfs.de \
--cc=linux-hams@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.