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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1334123633-11833-1-git-send-email-msink@permonline.ru>
Date:	Wed, 11 Apr 2012 11:53:53 +0600
From:	Mike Sinkovsky <msink@...monline.ru>
To:	netdev@...r.kernel.org, dan.carpenter@...cle.com,
	davem@...emloft.net
Cc:	Mike Sinkovsky <msink@...monline.ru>
Subject: [PATCH] net: WIZnet drivers: fix possible NULL dereference

This fixes possible null dereference in probe() function: when both 
.mac_addr and .link_gpio are unknown, dev.platform_data may be NULL

Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Mike Sinkovsky <msink@...monline.ru>
---
 drivers/net/ethernet/wiznet/w5100.c |    2 +-
 drivers/net/ethernet/wiznet/w5300.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index c28e1d5..157d2f0 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -682,7 +682,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)
 		return ret;
 	priv->irq = irq;
 
-	priv->link_gpio = data->link_gpio;
+	priv->link_gpio = data ? data->link_gpio : -EINVAL;
 	if (gpio_is_valid(priv->link_gpio)) {
 		char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
 		if (!link_name)
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index 88afde9..86d07bb 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -596,7 +596,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
 		return ret;
 	priv->irq = irq;
 
-	priv->link_gpio = data->link_gpio;
+	priv->link_gpio = data ? data->link_gpio : -EINVAL;
 	if (gpio_is_valid(priv->link_gpio)) {
 		char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
 		if (!link_name)
-- 
1.6.3.3


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ