public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [ 12/73] net/eth/ibmveth: Fixup retrieval of MAC address
Date: Thu,  9 May 2013 15:25:02 -0700	[thread overview]
Message-ID: <20130509222527.758274651@linuxfoundation.org> (raw)
In-Reply-To: <20130509222526.480204972@linuxfoundation.org>

3.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

commit 13f85203e1060da83d9ec1c1c5a63343eaab8de4 upstream.

Some ancient pHyp versions used to create a 8 bytes local-mac-address
property in the device-tree instead of a 6 bytes one for veth.

The Linux driver code to deal with that is an insane hack which also
happens to break with some choices of MAC addresses in qemu by testing
for a bit in the address rather than just looking at the size of the
property.

Sanitize this by doing the latter instead.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/ibm/ibmveth.c |   23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1324,7 +1324,7 @@ static const struct net_device_ops ibmve
 
 static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 {
-	int rc, i;
+	int rc, i, mac_len;
 	struct net_device *netdev;
 	struct ibmveth_adapter *adapter;
 	unsigned char *mac_addr_p;
@@ -1334,11 +1334,19 @@ static int ibmveth_probe(struct vio_dev
 		dev->unit_address);
 
 	mac_addr_p = (unsigned char *)vio_get_attribute(dev, VETH_MAC_ADDR,
-							NULL);
+							&mac_len);
 	if (!mac_addr_p) {
 		dev_err(&dev->dev, "Can't find VETH_MAC_ADDR attribute\n");
 		return -EINVAL;
 	}
+	/* Workaround for old/broken pHyp */
+	if (mac_len == 8)
+		mac_addr_p += 2;
+	else if (mac_len != 6) {
+		dev_err(&dev->dev, "VETH_MAC_ADDR attribute wrong len %d\n",
+			mac_len);
+		return -EINVAL;
+	}
 
 	mcastFilterSize_p = (unsigned int *)vio_get_attribute(dev,
 						VETH_MCAST_FILTER_SIZE, NULL);
@@ -1363,17 +1371,6 @@ static int ibmveth_probe(struct vio_dev
 
 	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
 
-	/*
-	 * Some older boxes running PHYP non-natively have an OF that returns
-	 * a 8-byte local-mac-address field (and the first 2 bytes have to be
-	 * ignored) while newer boxes' OF return a 6-byte field. Note that
-	 * IEEE 1275 specifies that local-mac-address must be a 6-byte field.
-	 * The RPA doc specifies that the first byte must be 10b, so we'll
-	 * just look for it to solve this 8 vs. 6 byte field issue
-	 */
-	if ((*mac_addr_p & 0x3) != 0x02)
-		mac_addr_p += 2;
-
 	adapter->mac_addr = 0;
 	memcpy(&adapter->mac_addr, mac_addr_p, 6);
 



  parent reply	other threads:[~2013-05-09 22:25 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09 22:24 [ 00/73] 3.9.2-stable review Greg Kroah-Hartman
2013-05-09 22:24 ` [ 01/73] xen/arm: actually pass a non-NULL percpu pointer to request_percpu_irq Greg Kroah-Hartman
2013-05-09 22:24 ` [ 02/73] powerpc: Emulate non privileged DSCR read and write Greg Kroah-Hartman
2013-05-09 22:24 ` [ 03/73] powerpc/tm: Fix null pointer deference in flush_hash_page Greg Kroah-Hartman
2013-05-09 22:24 ` [ 04/73] powerpc: fix numa distance for form0 device tree Greg Kroah-Hartman
2013-05-09 22:24 ` [ 05/73] pwm: spear: Fix checking return value of clk_enable() and clk_prepare() Greg Kroah-Hartman
2013-05-09 22:24 ` [ 06/73] autofs - remove autofs dentry mount check Greg Kroah-Hartman
2013-05-09 22:24 ` [ 07/73] rpmsg: fix kconfig dependencies for VIRTIO Greg Kroah-Hartman
2013-05-09 22:24 ` [ 08/73] remoteproc: " Greg Kroah-Hartman
2013-05-09 22:24 ` [ 09/73] hugetlbfs: fix mmap failure in unaligned size request Greg Kroah-Hartman
2013-05-09 22:25 ` [ 10/73] iommu/amd: Properly initialize irq-table lock Greg Kroah-Hartman
2013-05-09 22:25 ` [ 11/73] menuconfig: Fix memory leak introduced by jump keys feature Greg Kroah-Hartman
2013-05-09 22:25 ` Greg Kroah-Hartman [this message]
2013-05-09 22:25 ` [ 13/73] perf/x86/intel: Add support for IvyBridge model 58 Uncore Greg Kroah-Hartman
2013-05-09 22:25 ` [ 14/73] perf/x86/intel: Fix unintended variable name reuse Greg Kroah-Hartman
2013-05-09 22:25 ` [ 15/73] perf/x86: Blacklist all MEM_*_RETIRED events for Ivy Bridge Greg Kroah-Hartman
2013-05-09 22:25 ` [ 16/73] perf/x86/intel/lbr: Fix LBR filter Greg Kroah-Hartman
2013-05-09 22:25 ` [ 17/73] perf/x86/intel/lbr: Demand proper privileges for PERF_SAMPLE_BRANCH_KERNEL Greg Kroah-Hartman
2013-05-09 22:25 ` [ 18/73] ipvs: ip_vs_sip_fill_param() BUG: bad check of return value Greg Kroah-Hartman
2013-05-09 22:25 ` [ 19/73] ext4: add check for inodes_count overflow in new resize ioctl Greg Kroah-Hartman
2013-05-09 22:25 ` [ 20/73] MODSIGN: do not send garbage to stderr when enabling modules signature Greg Kroah-Hartman
2013-05-09 22:25 ` [ 21/73] r8169: fix 8168evl frame padding Greg Kroah-Hartman
2013-05-09 22:25 ` [ 22/73] RDMA/cxgb4: Fix SQ allocation when on-chip SQ is disabled Greg Kroah-Hartman
2013-05-09 22:25 ` [ 23/73] arm64: Ignore the write ESR flag on cache maintenance faults Greg Kroah-Hartman
2013-05-09 22:25 ` [ 24/73] blkcg: fix "scheduling while atomic" in blk_queue_bypass_start Greg Kroah-Hartman
2013-05-09 22:25 ` [ 25/73] block: fix max discard sectors limit Greg Kroah-Hartman
2013-05-09 22:25 ` [ 26/73] drm/cirrus: deal with bo reserve fail in dirty update path Greg Kroah-Hartman
2013-05-09 22:25 ` [ 27/73] drm/mgag200: " Greg Kroah-Hartman
2013-05-09 22:25 ` [ 28/73] drm/gma500: fix backlight hotkeys behaviour on netbooks Greg Kroah-Hartman
2013-05-09 22:25 ` [ 29/73] drm: prime: fix refcounting on the dmabuf import error path Greg Kroah-Hartman
2013-05-09 22:25 ` [ 30/73] drm/prime: keep a reference from the handle to exported dma-buf (v6) Greg Kroah-Hartman
2013-05-09 22:25 ` [ 31/73] drm/ast: deal with bo reserve fail in dirty update path Greg Kroah-Hartman
2013-05-09 22:25 ` [ 32/73] drm/i915: Fix sdvo connector get_hw_state function Greg Kroah-Hartman
2013-05-09 22:25 ` [ 33/73] drm/i915: Add no-lvds quirk for Fujitsu Esprimo Q900 Greg Kroah-Hartman
2013-05-09 22:25 ` [ 34/73] drm/i915: Fix SDVO connector and encoder get_hw_state functions Greg Kroah-Hartman
2013-05-09 22:25 ` [ 35/73] drm/i915: Workaround incoherence between fences and LLC across multiple CPUs Greg Kroah-Hartman
2013-05-09 22:25 ` [ 36/73] drm/i915: Use MLC (l3$) for context objects Greg Kroah-Hartman
2013-05-09 22:25 ` [ 37/73] drm/i915: set CPT FDI RX polarity bits based on VBT Greg Kroah-Hartman
2013-05-09 22:25 ` [ 38/73] drm/i915: dont check inconsistent modeset state when force-restoring Greg Kroah-Hartman
2013-05-09 22:25 ` [ 39/73] drm/i915: ensure single initialization and cleanup of backlight device Greg Kroah-Hartman
2013-05-09 22:25 ` [ 40/73] drm/i915: dont intel_crt_init on any ULT machines Greg Kroah-Hartman
2013-05-09 22:25 ` [ 41/73] drm/i915: Fixup Oops in the pipe config computation Greg Kroah-Hartman
2013-05-09 22:25 ` [ 42/73] drm/i915: Fall back to bit banging mode for DVO transmitter detection Greg Kroah-Hartman
2013-05-09 22:25 ` [ 43/73] drm/i915: correct the calculation of first_pd_entry_in_global_pt Greg Kroah-Hartman
2013-05-09 22:25 ` [ 44/73] drm/radeon: dont use get_engine_clock() on APUs Greg Kroah-Hartman
2013-05-09 22:25 ` [ 45/73] drm/radeon: use frac fb div on RS780/RS880 Greg Kroah-Hartman
2013-05-09 22:25 ` [ 46/73] drm/radeon: fix typo in rv515_mc_resume() Greg Kroah-Hartman
2013-05-09 22:25 ` [ 47/73] drm/radeon/dce6: add missing display reg for tiling setup Greg Kroah-Hartman
2013-05-09 22:25 ` [ 48/73] drm/radeon: update wait_for_vblank for r5xx-r7xx Greg Kroah-Hartman
2013-05-09 22:25 ` [ 49/73] drm/radeon: update wait_for_vblank for evergreen+ Greg Kroah-Hartman
2013-05-09 22:25 ` [ 50/73] drm/radeon: properly lock disp in mc_stop/resume " Greg Kroah-Hartman
2013-05-09 22:25 ` [ 51/73] drm/radeon: properly lock disp in mc_stop/resume for r5xx-r7xx Greg Kroah-Hartman
2013-05-09 22:25 ` [ 52/73] drm/radeon: update wait_for_vblank for r1xx-r4xx Greg Kroah-Hartman
2013-05-09 22:25 ` [ 53/73] drm/radeon: disable the crtcs in mc_stop (evergreen+) (v2) Greg Kroah-Hartman
2013-05-09 22:25 ` [ 54/73] drm/radeon: add some new SI PCI ids Greg Kroah-Hartman
2013-05-09 22:25 ` [ 55/73] drm/radeon/evergreen+: dont enable HPD interrupts on eDP/LVDS Greg Kroah-Hartman
2013-05-09 22:25 ` [ 56/73] drm/radeon: cleanup properly if mmio mapping fails Greg Kroah-Hartman
2013-05-09 22:25 ` [ 57/73] drm/radeon: fix hdmi mode enable on RS600/RS690/RS740 Greg Kroah-Hartman
2013-05-09 22:25 ` [ 58/73] drm/radeon: fix typo in si_select_se_sh() Greg Kroah-Hartman
2013-05-09 22:25 ` [ 59/73] drm/radeon: Always flush the VM Greg Kroah-Hartman
2013-05-09 22:25 ` [ 60/73] drm/radeon: disable the crtcs in mc_stop (r5xx-r7xx) (v2) Greg Kroah-Hartman
2013-05-09 22:25 ` [ 61/73] drm/radeon: fix endian bugs in atom_allocate_fb_scratch() Greg Kroah-Hartman
2013-05-09 22:25 ` [ 62/73] drm/radeon: fix possible segfault when parsing pm tables Greg Kroah-Hartman
2013-05-09 22:25 ` [ 63/73] drm/radeon: add new richland pci ids Greg Kroah-Hartman
2013-05-09 22:25 ` [ 64/73] drm/radeon: fix handling of v6 power tables Greg Kroah-Hartman
2013-05-09 22:25 ` [ 65/73] drm/tilcdc: Fix an incorrect condition Greg Kroah-Hartman
2013-05-09 22:25 ` [ 66/73] tracing: Fix ftrace_dump() Greg Kroah-Hartman
2013-05-09 22:25 ` [ 67/73] Btrfs: compare relevant parts of delayed tree refs Greg Kroah-Hartman
2013-05-09 22:25 ` [ 68/73] Btrfs: fix extent logging with O_DIRECT into prealloc Greg Kroah-Hartman
2013-05-09 22:25 ` [ 69/73] EDAC: Dont give write permission to read-only files Greg Kroah-Hartman
2013-05-09 22:26 ` [ 70/73] PCI: Delay final fixups until resources are assigned Greg Kroah-Hartman
2013-05-09 22:26 ` [ 71/73] qmi_wwan/cdc_ether: add device IDs for Dell 5804 (Novatel E371) WWAN card Greg Kroah-Hartman
2013-05-09 22:26 ` [ 72/73] NFSv4.x: Fix handling of partially delegated locks Greg Kroah-Hartman
2013-05-09 22:26 ` [ 73/73] kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees() Greg Kroah-Hartman
2013-05-10 15:23 ` [ 00/73] 3.9.2-stable review Shuah Khan
2013-05-10 15:28   ` Greg Kroah-Hartman
2013-05-11  5:26 ` Satoru Takeuchi
2013-05-11 13:53   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130509222527.758274651@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox