From: Greg Kroah-Hartman Date: Thu, 19 Apr 2012 18:44:34 +0000 (-0700) Subject: 3.2-stable patches X-Git-Tag: v3.2.16~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79c7fdc8da4902edd8f3cafe1ff218d78a2a7830;p=thirdparty%2Fkernel%2Fstable-queue.git 3.2-stable patches added patches: pch_gbe-do-not-abort-probe-on-bad-mac.patch pch_gbe-memory-corruption-calling-pch_gbe_validate_option.patch --- diff --git a/queue-3.2/pch_gbe-do-not-abort-probe-on-bad-mac.patch b/queue-3.2/pch_gbe-do-not-abort-probe-on-bad-mac.patch new file mode 100644 index 00000000000..5237ffc7e77 --- /dev/null +++ b/queue-3.2/pch_gbe-do-not-abort-probe-on-bad-mac.patch @@ -0,0 +1,79 @@ +From 2b53d07891630dead46d65c8f896955fd3ae0302 Mon Sep 17 00:00:00 2001 +From: Darren Hart +Date: Mon, 16 Jan 2012 09:50:19 +0000 +Subject: pch_gbe: Do not abort probe on bad MAC + +From: Darren Hart + +commit 2b53d07891630dead46d65c8f896955fd3ae0302 upstream. + +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. + +Signed-off-by: Darren Hart +CC: Arjan van de Ven +CC: Alan Cox +CC: Tomoya MORINAGA +CC: Jeff Kirsher +CC: "David S. Miller" +CC: Paul Gortmaker +CC: Jon Mason +CC: Mark Brown +CC: David Laight +CC: Joe Perches +Signed-off-by: David S. Miller +Signed-off-by: Tomoya MORINAGA +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c ++++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +@@ -1745,6 +1745,12 @@ int pch_gbe_up(struct pch_gbe_adapter *a + 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); + +@@ -2467,9 +2473,14 @@ static int pch_gbe_probe(struct pci_dev + + 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); diff --git a/queue-3.2/pch_gbe-memory-corruption-calling-pch_gbe_validate_option.patch b/queue-3.2/pch_gbe-memory-corruption-calling-pch_gbe_validate_option.patch new file mode 100644 index 00000000000..76043a11c9d --- /dev/null +++ b/queue-3.2/pch_gbe-memory-corruption-calling-pch_gbe_validate_option.patch @@ -0,0 +1,53 @@ +From 73f98eab9b9e0bab492ca06add5657d9e702ddb1 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 29 Feb 2012 21:17:08 +0000 +Subject: pch_gbe: memory corruption calling pch_gbe_validate_option() + +From: Dan Carpenter + +commit 73f98eab9b9e0bab492ca06add5657d9e702ddb1 upstream. + +pch_gbe_validate_option() modifies 32 bits of memory but we pass +&hw->phy.autoneg_advertised which only has 16 bits and &hw->mac.fc +which only has 8 bits. + +Signed-off-by: Dan Carpenter +Signed-off-by: David S. Miller +Signed-off-by: Tomoya MORINAGA +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c ++++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +@@ -321,10 +321,10 @@ static void pch_gbe_check_copper_options + pr_debug("AutoNeg specified along with Speed or Duplex, AutoNeg parameter ignored\n"); + hw->phy.autoneg_advertised = opt.def; + } else { +- hw->phy.autoneg_advertised = AutoNeg; +- pch_gbe_validate_option( +- (int *)(&hw->phy.autoneg_advertised), +- &opt, adapter); ++ int tmp = AutoNeg; ++ ++ pch_gbe_validate_option(&tmp, &opt, adapter); ++ hw->phy.autoneg_advertised = tmp; + } + } + +@@ -495,9 +495,10 @@ void pch_gbe_check_options(struct pch_gb + .arg = { .l = { .nr = (int)ARRAY_SIZE(fc_list), + .p = fc_list } } + }; +- hw->mac.fc = FlowControl; +- pch_gbe_validate_option((int *)(&hw->mac.fc), +- &opt, adapter); ++ int tmp = FlowControl; ++ ++ pch_gbe_validate_option(&tmp, &opt, adapter); ++ hw->mac.fc = tmp; + } + + pch_gbe_check_copper_options(adapter); diff --git a/queue-3.2/series b/queue-3.2/series index 8d497d78bce..1ae3ba9587d 100644 --- a/queue-3.2/series +++ b/queue-3.2/series @@ -54,3 +54,5 @@ usb-gadget-pch_udc-fix-usb-gadget-pch_udc-fix-ether.patch usb-gadget-pch_udc-reduce-redundant-interrupt.patch acpica-fix-to-allow-region-arguments-to-reference-other-scopes.patch security-fix-compile-error-in-commoncap.c.patch +pch_gbe-do-not-abort-probe-on-bad-mac.patch +pch_gbe-memory-corruption-calling-pch_gbe_validate_option.patch