Skip to content

Commit

Permalink
drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wenliang Fan authored and David S. Miller committed Dec 19, 2013
1 parent 0c8d087 commit e9db5c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/hamradio/hdlcdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e9db5c2

Please sign in to comment.