Commit fb3ce90b authored by Firo Yang's avatar Firo Yang Committed by David S. Miller

hdlcdrv: Fix divide by zero in hdlcdrv_ioctl

syszkaller fuzzer triggered a divide by zero, when set calibration
through ioctl().

To fix it, test 'bitrate' if it is negative or 0, just return -EINVAL.
Reported-by: default avatarAndrey Konovalov <>
Signed-off-by: default avatarFiro Yang <>
Signed-off-by: default avatarDavid S. Miller <>
parent 6c713a3a
......@@ -576,6 +576,8 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return -EPERM;
if (s->par.bitrate <= 0)
return -EINVAL;
if ( > INT_MAX / s->par.bitrate)
return -EINVAL;
s->hdlctx.calibrate = * s->par.bitrate / 16;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment