Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1651418 > unrolled thread
| Started by | Firo Yang <firogm@gmail.com> |
|---|---|
| First post | 2017-05-26 16:50 +0200 |
| Last post | 2017-05-28 00:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v3] hdlcdrv: Fix divide by zero in hdlcdrv_ioctl Firo Yang <firogm@gmail.com> - 2017-05-26 16:50 +0200
Re: [PATCH v3] hdlcdrv: Fix divide by zero in hdlcdrv_ioctl David Miller <davem@davemloft.net> - 2017-05-28 00:50 +0200
| From | Firo Yang <firogm@gmail.com> |
|---|---|
| Date | 2017-05-26 16:50 +0200 |
| Subject | [PATCH v3] hdlcdrv: Fix divide by zero in hdlcdrv_ioctl |
| Message-ID | <tLoIV-77d-9@gated-at.bofh.it> |
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: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Firo Yang <firogm@gmail.com>
---
v2->v3:
Just fix divide error and remove netif_running() test.
Refine the testing code as David Miller suggested.
v1->v2:
Change Reported-by to Andrey Konovalov.
Send it to original report thread.
v0->v1:
Reviewed by walter harms <wharms@bfs.de>.
Return ENODEV instead of EPERM if !netif_running(dev)
Check if s->par.bitrate > 0.
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 8c3633c..97e3bc6 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -576,6 +576,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 (s->par.bitrate <= 0)
+ return -EINVAL;
if (bi.data.calibrate > INT_MAX / s->par.bitrate)
return -EINVAL;
s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
--
2.9.4
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-05-28 00:50 +0200 |
| Message-ID | <tLSGZ-1L7-3@gated-at.bofh.it> |
| In reply to | #1651418 |
From: Firo Yang <firogm@gmail.com> Date: Fri, 26 May 2017 22:37:38 +0800 > 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: Andrey Konovalov <andreyknvl@google.com> > Signed-off-by: Firo Yang <firogm@gmail.com> Applied, thank you.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web