lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1495080138-21695-1-git-send-email-firogm@gmail.com>
Date:   Thu, 18 May 2017 12:02:18 +0800
From:   Firo Yang <firogm@...il.com>
To:     t.sailer@...mni.ethz.ch, wharms@....de
Cc:     linux-hams@...r.kernel.org, netdev@...r.kernel.org,
        dvyukov@...gle.com, syzkaller@...glegroups.com,
        davem@...emloft.net, gregkh@...uxfoundation.org,
        Firo Yang <firogm@...il.com>
Subject: [[PATCH v1]] hdlcdrv: fix divide error bug if bitrate is 0

The divisor s->par.bitrate will always be 0 until initialized by
ndo_open() and hdlcdrv_open().

In order to fix this divide zero error, check whether the netdevice was
opened by ndo_open() before performing divide.And we also check the the
value of bitrate in case of bad setting of it.

Reported-by: Dmitry Vyukov <dvyukov@...gle.com>
Signed-off-by: Firo Yang <firogm@...il.com>
---
v0->v1:
	Reviewed by walter harms <wharms@....de>.
	Return ENODEV instead of EPERM if !netif_running(dev)
	Check if s->par.bitrate > 0.

 drivers/net/hamradio/hdlcdrv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 8c3633c..b0f417f 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -576,6 +576,10 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	case HDLCDRVCTL_CALIBRATE:
 		if(!capable(CAP_SYS_RAWIO))
 			return -EPERM;
+		if (!netif_running(dev))
+			return -ENODEV;
+		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.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ