summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenliang Fan <fanwlexca@gmail.com>2013-12-17 07:25:28 +0400
committerBen Hutchings <ben@decadent.org.uk>2014-02-15 23:20:09 +0400
commit6ea9c09b5c3b6248ae4fed3240e6aefbefa2169b (patch)
treed5d0432aaacf11c7a0ffad15b8d7466dd615c172
parent9229facbdf76c2a13bcc5eacdcccb89ea49a6f92 (diff)
downloadlinux-6ea9c09b5c3b6248ae4fed3240e6aefbefa2169b.tar.xz
drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
[ Upstream commit e9db5c21d3646a6454fcd04938dd215ac3ab620a ] 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/net/hamradio/hdlcdrv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index a4a3516b6bbf..3b3a7e07bbf1 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;