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>] [day] [month] [year] [list]
Message-Id: <1334904885-10171-1-git-send-email-tomoya.rohm@gmail.com>
Date:	Fri, 20 Apr 2012 15:54:45 +0900
From:	Tomoya MORINAGA <tomoya.rohm@...il.com>
To:	stable@...r.kernel.org
Cc:	Darren Hart <dvhart@...ux.intel.com>,
	Arjan van de Ven <arjan@...ux.intel.com>,
	Alan Cox <alan@...ux.intel.com>,
	Tomoya MORINAGA <tomoya.rohm@...il.com>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	"David S. Miller" <davem@...emloft.net>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Jon Mason <jdmason@...zu.us>, netdev@...r.kernel.org,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	David Laight <David.Laight@...LAB.COM>,
	Joe Perches <joe@...ches.com>
Subject: [PATCH 1/2 v2] pch_gbe: Do not abort probe on bad MAC

From: Darren Hart <dvhart@...ux.intel.com>

If the MAC is invalid or not implemented, do not abort the probe. Issue
a warning and prevent bringing the interface up until a MAC is set manually
(via ifconfig $IFACE hw ether $MAC).

Tested on two platforms, one with a valid MAC, the other without a MAC. The real
MAC is used if present, the interface fails to come up until the MAC is set on
the other. They successfully get an IP over DHCP and pass a simple ping and
login over ssh test.

This is meant to allow the Inforce SYS940X development board:
http://www.inforcecomputing.com/SYS940X_ECX.html
(and others suffering from a missing MAC) to work with the mainline kernel.
Without this patch, the probe will fail and the interface will not be created,
preventing the user from configuring the MAC manually.

This does not make any attempt to address a missing or invalid MAC for the
pch_phub driver.

commit 2b53d07891630dead46d65c8f896955fd3ae0302
kernel 3.0

Cc: stable@...r.kernel.org
Signed-off-by: Darren Hart <dvhart@...ux.intel.com>
CC: Arjan van de Ven <arjan@...ux.intel.com>
CC: Alan Cox <alan@...ux.intel.com>
CC: Tomoya MORINAGA <tomoya.rohm@...il.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
CC: "David S. Miller" <davem@...emloft.net>
CC: Paul Gortmaker <paul.gortmaker@...driver.com>
CC: Jon Mason <jdmason@...zu.us>
CC: netdev@...r.kernel.org
CC: Mark Brown <broonie@...nsource.wolfsonmicro.com>
CC: David Laight <David.Laight@...LAB.COM>
CC: Joe Perches <joe@...ches.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Tomoya MORINAGA <tomoya.rohm@...il.com>
---
v2
 - Separate into 2 patches because folder structure was changed.
---
 drivers/net/pch_gbe/pch_gbe_main.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index eac3c5c..e7412f2 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -1701,6 +1701,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
 	struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring;
 	int err;
 
+	/* Ensure we have a valid MAC */
+	if (!is_valid_ether_addr(adapter->hw.mac.addr)) {
+		pr_err("Error: Invalid MAC address\n");
+		return -EINVAL;
+	}
+
 	/* hardware has been reset, we need to reload some things */
 	pch_gbe_set_multi(netdev);
 
@@ -2392,9 +2398,14 @@ static int pch_gbe_probe(struct pci_dev *pdev,
 
 	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		dev_err(&pdev->dev, "Invalid MAC Address\n");
-		ret = -EIO;
-		goto err_free_adapter;
+		/*
+		 * If the MAC is invalid (or just missing), display a warning
+		 * but do not abort setting up the device. pch_gbe_up will
+		 * prevent the interface from being brought up until a valid MAC
+		 * is set.
+		 */
+		dev_err(&pdev->dev, "Invalid MAC address, "
+		                    "interface disabled.\n");
 	}
 	setup_timer(&adapter->watchdog_timer, pch_gbe_watchdog,
 		    (unsigned long)adapter);
-- 
1.7.7.6

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