From: Wenliang Fan <fanwlexca@gmail.com>
To: davem@davemloft.net, michael.opdenacker@free-electrons.com,
gaofeng@cn.fujitsu.com, akpm@linux-foundation.org,
t.sailer@alumni.ethz.ch
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Wenliang Fan <fanwlexca@gmail.com>
Subject: [PATCH] drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
Date: Tue, 17 Dec 2013 11:25:28 +0800 [thread overview]
Message-ID: <1387250728-10795-1-git-send-email-fanwlexca@gmail.com> (raw)
The local variable 'bi' comes from userspace. If userspace passed a
large number to 'bi.data.calibrate', there would be an integer overflow
in the following line:
s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
Signed-off-by: Wenliang Fan <fanwlexca@gmail.com>
---
drivers/net/hamradio/hdlcdrv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 3169252..5d78c1d 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -571,6 +571,8 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
case HDLCDRVCTL_CALIBRATE:
if(!capable(CAP_SYS_RAWIO))
return -EPERM;
+ if (bi.data.calibrate > INT_MAX / s->par.bitrate)
+ return -EINVAL;
s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
return 0;
--
1.8.5.rc1.28.g7061504
next reply other threads:[~2013-12-17 3:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 3:25 Wenliang Fan [this message]
2013-12-19 20:03 ` [PATCH] drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl() 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=1387250728-10795-1-git-send-email-fanwlexca@gmail.com \
--to=fanwlexca@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.opdenacker@free-electrons.com \
--cc=netdev@vger.kernel.org \
--cc=t.sailer@alumni.ethz.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).