From: Alan Cox <alan@llwyncelyn.cymru>
To: mchehab@kernel.org, linux-media@vger.kernel.org
Subject: [PATCH 05/12] hdlcdrv: Fix division by zero when bitrate is unset
Date: Fri, 26 May 2017 16:26:42 +0100 [thread overview]
Message-ID: <149581238775.17406.4594436624734437821.stgit@builder> (raw)
In-Reply-To: <149581234670.17406.8086980349538517529.stgit@builder>
The code attempts to check for out of range calibration. What it forgets to do
is check for the 0 bitrate case. As a result the range check itself oopses the
kernel.
Found by Andrey Konovalov using Syzkaller.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/net/hamradio/hdlcdrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 8c3633c..9f34a48 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -576,7 +576,7 @@ 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)
+ if (!s->par.bitrate || bi.data.calibrate > INT_MAX / s->par.bitrate)
return -EINVAL;
s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
return 0;
prev parent reply other threads:[~2017-05-26 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 15:25 [PATCH 01/12] atompisp: HAS_BL is never defined so lose it Alan Cox
2017-05-26 15:25 ` [PATCH 02/12] atomisp: remove NUM_OF_BLS Alan Cox
2017-05-26 15:26 ` [PATCH 03/12] atomisp2: remove HRT_UNSCHED Alan Cox
2017-05-26 15:26 ` [PATCH 04/12] atomisp2: tidy up confused ifdefs Alan Cox
2017-05-26 15:26 ` Alan Cox [this message]
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=149581238775.17406.4594436624734437821.stgit@builder \
--to=alan@llwyncelyn.cymru \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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