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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed,  6 Feb 2008 10:39:19 +0100
From:	Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
To:	netdev@...r.kernel.org
Cc:	Uwe Kleine-König 
	<ukleinek@...ormatik.uni-freiburg.de>,
	Andy Fleming <afleming@...escale.com>
Subject: [RESENT PATCH] mdiobus_register: check bus not being NULL before dereferencing it

From: Uwe Kleine-König <ukleinek@...ormatik.uni-freiburg.de>

It doesn't make much sense to check for bus being NULL after using
bus->mdio_lock.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
Cc: Andy Fleming <afleming@...escale.com>
---
Hello,

I already sent this patch on November 7, 2007, but without any feedback.

This is rebased to current Linus' master to account for 35b5f6b1.

Best regards
Uwe

 drivers/net/phy/mdio_bus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6e9f619..963630c 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,13 +49,13 @@ int mdiobus_register(struct mii_bus *bus)
 	int i;
 	int err = 0;
 
-	mutex_init(&bus->mdio_lock);
-
 	if (NULL == bus || NULL == bus->name ||
 			NULL == bus->read ||
 			NULL == bus->write)
 		return -EINVAL;
 
+	mutex_init(&bus->mdio_lock);
+
 	if (bus->reset)
 		bus->reset(bus);
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists