mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk,
	Santiago Leon <santil@linux.vnet.ibm.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [ 112/135] ibmveth: Fix alignment of rx queue bug
Date: Mon, 17 Sep 2012 01:38:17 +0100	[thread overview]
Message-ID: <20120917003641.721250035@decadent.org.uk> (raw)
In-Reply-To: <20120917003625.784119135@decadent.org.uk>

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

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

From: Santiago Leon <santil@linux.vnet.ibm.com>

commit d90c92fee89ccd75ef2646f3bde0b4c0450666c3 upstream.

This patch fixes a bug found by Nish Aravamudan
(https://lkml.org/lkml/2012/5/15/220) where the driver is not following
the spec (it is not aligning the rx buffer on a 16-byte boundary) and the
hypervisor aborts the registration, making the device unusable.

The fix follows BenH's recommendation (https://lkml.org/lkml/2012/7/20/461)
to replace the kmalloc+map for a single call to dma_alloc_coherent()
because that function always aligns to a 16-byte boundary.

The stable trees will run into this bug whenever the rx buffer kmalloc call
returns something not aligned on a 16-byte boundary.

Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ethernet/ibm/ibmveth.c |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 9010cea..b68d28a 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -472,14 +472,9 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
 	}
 
 	if (adapter->rx_queue.queue_addr != NULL) {
-		if (!dma_mapping_error(dev, adapter->rx_queue.queue_dma)) {
-			dma_unmap_single(dev,
-					adapter->rx_queue.queue_dma,
-					adapter->rx_queue.queue_len,
-					DMA_BIDIRECTIONAL);
-			adapter->rx_queue.queue_dma = DMA_ERROR_CODE;
-		}
-		kfree(adapter->rx_queue.queue_addr);
+		dma_free_coherent(dev, adapter->rx_queue.queue_len,
+				  adapter->rx_queue.queue_addr,
+				  adapter->rx_queue.queue_dma);
 		adapter->rx_queue.queue_addr = NULL;
 	}
 
@@ -556,10 +551,13 @@ static int ibmveth_open(struct net_device *netdev)
 		goto err_out;
 	}
 
+	dev = &adapter->vdev->dev;
+
 	adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) *
 						rxq_entries;
-	adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len,
-						GFP_KERNEL);
+	adapter->rx_queue.queue_addr =
+	    dma_alloc_coherent(dev, adapter->rx_queue.queue_len,
+			       &adapter->rx_queue.queue_dma, GFP_KERNEL);
 
 	if (!adapter->rx_queue.queue_addr) {
 		netdev_err(netdev, "unable to allocate rx queue pages\n");
@@ -567,19 +565,13 @@ static int ibmveth_open(struct net_device *netdev)
 		goto err_out;
 	}
 
-	dev = &adapter->vdev->dev;
-
 	adapter->buffer_list_dma = dma_map_single(dev,
 			adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL);
 	adapter->filter_list_dma = dma_map_single(dev,
 			adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL);
-	adapter->rx_queue.queue_dma = dma_map_single(dev,
-			adapter->rx_queue.queue_addr,
-			adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL);
 
 	if ((dma_mapping_error(dev, adapter->buffer_list_dma)) ||
-	    (dma_mapping_error(dev, adapter->filter_list_dma)) ||
-	    (dma_mapping_error(dev, adapter->rx_queue.queue_dma))) {
+	    (dma_mapping_error(dev, adapter->filter_list_dma))) {
 		netdev_err(netdev, "unable to map filter or buffer list "
 			   "pages\n");
 		rc = -ENOMEM;



  parent reply	other threads:[~2012-09-17  1:17 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17  0:36 [ 000/135] 3.2.30-stable review Ben Hutchings
2012-09-17  0:36 ` [ 001/135] [PARISC] Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts Ben Hutchings
2012-09-17  0:36 ` [ 002/135] ARM: S3C24XX: Fix s3c2410_dma_enqueue parameters Ben Hutchings
2012-09-17  0:36 ` [ 003/135] ARM: OMAP2+: Fix dmtimer set source clock failure Ben Hutchings
2012-09-17  0:36 ` [ 004/135] ARM: Orion: Set eth packet size csum offload limit Ben Hutchings
2012-09-17  0:36 ` [ 005/135] iwlwifi: fix flow handler debug code Ben Hutchings
2012-09-17  0:36 ` [ 006/135] iwlwifi: protect SRAM debugfs Ben Hutchings
2012-09-17  0:36 ` [ 007/135] Input: i8042 - add Gigabyte T1005 series netbooks to noloop table Ben Hutchings
2012-09-17  0:36 ` [ 008/135] [SCSI] mpt2sas: Fix for Driver oops, when loading driver with max_queue_depth command line option to a very small value Ben Hutchings
2012-09-17  0:36 ` [ 009/135] [SCSI] megaraid_sas: Move poll_aen_lock initializer Ben Hutchings
2012-09-17  0:36 ` [ 010/135] [SCSI] Fix Device not ready issue on mpt2sas Ben Hutchings
2012-09-17  0:36 ` [ 011/135] hwmon: (asus_atk0110) Add quirk for Asus M5A78L Ben Hutchings
2012-09-17  0:36 ` [ 012/135] drm/i915: Fix assert_pch_hdmi_disabled to mention HDMI (not DP) Ben Hutchings
2012-09-17  0:36 ` [ 013/135] drm/i915: fix wrong order of parameters in port checking functions Ben Hutchings
2012-09-17  0:36 ` [ 014/135] OMAPFB: fix framebuffer console colors Ben Hutchings
2012-09-17  0:36 ` [ 015/135] ARM: imx6: spin the cpu until hardware takes it down Ben Hutchings
2012-09-17  0:36 ` [ 016/135] ARM: dts: imx51-babbage: fix esdhc cd/wp properties Ben Hutchings
2012-09-17  0:36 ` [ 017/135] xen/setup: Fix one-off error when adding for-balloon PFNs to the P2M Ben Hutchings
2012-09-17  0:36 ` [ 018/135] ARM: imx: select CPU_FREQ_TABLE when needed Ben Hutchings
2012-09-17  0:36 ` [ 019/135] drm: remove some potentially dangerous DRM_ERRORs Ben Hutchings
2012-09-17  0:36 ` [ 020/135] drm: Check for invalid cursor flags Ben Hutchings
2012-09-17  0:36 ` [ 021/135] HID: multitouch: support PixArt optical touch screen Ben Hutchings
2012-09-17  0:36 ` [ 022/135] HID: add NOGET quirk for Eaton Ellipse MAX UPS Ben Hutchings
2012-09-17  0:36 ` [ 023/135] drm/radeon: dont disable plls that are in use by other crtcs Ben Hutchings
2012-09-17  0:36 ` [ 024/135] drm/radeon/atom: rework DIG modesetting on DCE3+ Ben Hutchings
2012-09-17  0:36 ` [ 025/135] drm/radeon: force dma32 to fix regression rs4xx,rs6xx,rs740 Ben Hutchings
2012-09-17  0:36 ` [ 026/135] drm/edid/quirks: ViewSonic VA2026w Ben Hutchings
2012-09-17  0:36 ` [ 027/135] drm: Add EDID_QUIRK_FORCE_REDUCED_BLANKING for ASUS VW222S Ben Hutchings
2012-09-17  0:36 ` [ 028/135] e1000e: DoS while TSO enabled caused by link partner with small MSS Ben Hutchings
2012-09-17  0:36 ` [ 029/135] ext3: Fix fdatasync() for files with only i_size changes Ben Hutchings
2012-09-17  0:36 ` [ 030/135] UBI: fix a horrible memory deallocation bug Ben Hutchings
2012-09-17  0:36 ` [ 031/135] fuse: fix retrieve length Ben Hutchings
2012-09-17  0:36 ` [ 032/135] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Ben Hutchings
2012-09-17  0:36 ` [ 033/135] mmc: mxs-mmc: fix deadlock caused by recursion loop Ben Hutchings
2012-09-17  0:36 ` [ 034/135] mmc: sdhci-esdhc: break out early if clock is 0 Ben Hutchings
2012-09-17  0:37 ` [ 035/135] mmc: card: Skip secure erase on MoviNAND; causes unrecoverable corruption Ben Hutchings
2012-09-17  0:37 ` [ 036/135] powerpc: Update DSCR on all CPUs when writing sysfs dscr_default Ben Hutchings
2012-09-17  0:37 ` [ 037/135] powerpc: Keep thread.dscr and thread.dscr_inherit in sync Ben Hutchings
2012-09-17  0:37 ` [ 038/135] powerpc: Fix DSCR inheritance in copy_thread() Ben Hutchings
2012-09-17  0:37 ` [ 039/135] powerpc: Restore correct DSCR in context switch Ben Hutchings
2012-09-17  0:37 ` [ 040/135] powerpc/xics: Harden xics hypervisor backend Ben Hutchings
2012-09-17  0:37 ` [ 041/135] powerpc: Make sure IPI handlers see data written by IPI senders Ben Hutchings
2012-09-17  0:37 ` [ 042/135] udf: Fix data corruption for files in ICB Ben Hutchings
2012-09-17  0:37 ` [ 043/135] xen: Use correct masking in xen_swiotlb_alloc_coherent Ben Hutchings
2012-09-17  0:37 ` [ 044/135] Remove user-triggerable BUG from mpol_to_str Ben Hutchings
2012-09-17  0:37 ` [ 045/135] CIFS: Fix error handling in cifs_push_mandatory_locks Ben Hutchings
2012-09-17  0:37 ` [ 046/135] drm/vmwgfx: add MODULE_DEVICE_TABLE so vmwgfx loads at boot Ben Hutchings
2012-09-17  0:37 ` [ 047/135] i2c-designware: Fix build error if CONFIG_I2C_DESIGNWARE_PLATFORM=y && CONFIG_I2C_DESIGNWARE_PCI=y Ben Hutchings
2012-09-17  0:37 ` [ 048/135] net: Allow driver to limit number of GSO segments per skb Ben Hutchings
2012-09-17  0:37 ` [ 049/135] sfc: Fix maximum number of TSO segments and minimum TX queue size Ben Hutchings
2012-09-17  0:37 ` [ 050/135] tcp: Apply device TSO segment limit earlier Ben Hutchings
2012-09-17  0:37 ` [ 051/135] net_sched: gact: Fix potential panic in tcf_gact() Ben Hutchings
2012-09-17  0:37 ` [ 052/135] isdnloop: fix and simplify isdnloop_init() Ben Hutchings
2012-09-17  0:37 ` [ 053/135] pptp: lookup route with the proper net namespace Ben Hutchings
2012-09-17  0:37 ` [ 054/135] net/core: Fix potential memory leak in dev_set_alias() Ben Hutchings
2012-09-17  0:37 ` [ 055/135] af_packet: remove BUG statement in tpacket_destruct_skb Ben Hutchings
2012-09-17  0:37 ` [ 056/135] ipv6: addrconf: Avoid calling netdevice notifiers with RCU read-side lock Ben Hutchings
2012-09-17  0:37 ` [ 057/135] atm: fix info leak in getsockopt(SO_ATMPVC) Ben Hutchings
2012-09-17  0:37 ` [ 058/135] atm: fix info leak via getsockname() Ben Hutchings
2012-09-17  0:37 ` [ 059/135] Bluetooth: HCI - Fix info leak in getsockopt(HCI_FILTER) Ben Hutchings
2012-09-17  0:37 ` [ 060/135] Bluetooth: HCI - Fix info leak via getsockname() Ben Hutchings
2012-09-17  0:37 ` [ 061/135] Bluetooth: RFCOMM - Fix info leak in getsockopt(BT_SECURITY) Ben Hutchings
2012-09-17  0:37 ` [ 062/135] Bluetooth: RFCOMM - Fix info leak in ioctl(RFCOMMGETDEVLIST) Ben Hutchings
2012-09-17  0:37 ` [ 063/135] Bluetooth: RFCOMM - Fix info leak via getsockname() Ben Hutchings
2012-09-17  0:37 ` [ 064/135] Bluetooth: L2CAP " Ben Hutchings
2012-09-17  0:37 ` [ 065/135] llc: fix " Ben Hutchings
2012-09-17  0:37 ` [ 066/135] dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO) Ben Hutchings
2012-09-17  0:37 ` [ 067/135] ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT) Ben Hutchings
2012-09-17  0:37 ` [ 068/135] net: fix info leak in compat dev_ifconf() Ben Hutchings
2012-09-17  0:37 ` [ 069/135] af_packet: dont emit packet on orig fanout group Ben Hutchings
2012-09-17  0:37 ` [ 070/135] af_netlink: force credentials passing [CVE-2012-3520] Ben Hutchings
2012-09-17  0:37 ` [ 071/135] netlink: fix possible spoofing from non-root processes Ben Hutchings
2012-09-17  0:37 ` [ 072/135] gianfar: fix default tx vlan offload feature flag Ben Hutchings
2012-09-17  0:37 ` [ 073/135] l2tp: avoid to use synchronize_rcu in tunnel free function Ben Hutchings
2012-09-17  0:37 ` [ 074/135] net: ipv4: ipmr_expire_timer causes crash when removing net namespace Ben Hutchings
2012-09-17  0:37 ` [ 075/135] bnx2x: fix 57840_MF pci id Ben Hutchings
2012-09-17  0:37 ` [ 076/135] workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic Ben Hutchings
2012-09-17  0:37 ` [ 077/135] fixing dmi match for hp t5745 and hp st5747 thin client Ben Hutchings
2012-09-17  0:37 ` [ 078/135] time: Improve sanity checking of timekeeping inputs Ben Hutchings
2012-09-17  0:37 ` [ 079/135] time: Avoid making adjustments if we havent accumulated anything Ben Hutchings
2012-09-17  0:37 ` [ 080/135] time: Move ktime_t overflow checking into timespec_valid_strict Ben Hutchings
2012-09-17  0:37 ` [ 081/135] drm/i915: Wait for all pending operations to the fb before disabling the pipe Ben Hutchings
2012-09-17  0:37 ` [ 082/135] xhci: Fix bug after deq ptr set to link TRB Ben Hutchings
2012-09-17  0:37 ` [ 083/135] ARM: 7487/1: mm: avoid setting nG bit for user mappings that arent present Ben Hutchings
2012-09-17  0:37 ` [ 084/135] i2c-i801: Add device IDs for Intel Lynx Point Ben Hutchings
2012-09-17  0:37 ` [ 085/135] i2c-i801: Add Device IDs for Intel Lynx Point-LP PCH Ben Hutchings
2012-09-17  0:37 ` [ 086/135] USB: option: add ZTE K5006-Z Ben Hutchings
2012-09-17  0:37 ` [ 087/135] USB: option: replace ZTE K5006-Z entry with vendor class rule Ben Hutchings
2012-09-17  0:37 ` [ 088/135] ARM: 7496/1: hw_breakpoint: dont rely on dfsr to show watchpoint access type Ben Hutchings
2012-09-17  0:37 ` [ 089/135] drm/i915: SDVO hotplug have different interrupt status bits for i915/i965/g4x Ben Hutchings
2012-09-17  0:37 ` [ 090/135] drm/i915: only enable sdvo hotplug irq if needed Ben Hutchings
2012-09-17  0:37 ` [ 091/135] can: mcp251x: avoid repeated frame bug Ben Hutchings
2012-09-17  0:37 ` [ 092/135] perf_event: Switch to internal refcount, fix race with close() Ben Hutchings
2012-09-17  0:37 ` [ 093/135] NFS: Fix the initialisation of the readdir cookieverf array Ben Hutchings
2012-09-17  0:37 ` [ 094/135] NFS: Fix a problem with the legacy binary mount code Ben Hutchings
2012-09-17  0:38 ` [ 095/135] staging: comedi: das08: Correct AI encoding for das08jr-16-ao Ben Hutchings
2012-09-17  0:38 ` [ 096/135] staging: comedi: das08: Correct AO output " Ben Hutchings
2012-09-17  0:38 ` [ 097/135] staging: vt6656: [BUG] - Failed connection, incorrect endian Ben Hutchings
2012-09-17  0:38 ` [ 098/135] xhci: Recognize USB 3.0 devices as superspeed at powerup Ben Hutchings
2012-09-17  0:38 ` [ 099/135] Intel xhci: Only switch the switchable ports Ben Hutchings
2012-09-17  0:38 ` [ 100/135] rt2x00: Identify ASUS USB-N53 device Ben Hutchings
2012-09-17  0:38 ` [ 101/135] rt2x00: Fix word size of rt2500usb MAC_CSR19 register Ben Hutchings
2012-09-17  0:38 ` [ 102/135] rt2x00: Fix rfkill polling prior to interface start Ben Hutchings
2012-09-17  0:38 ` [ 103/135] rt2800usb: Added rx packet length validity check Ben Hutchings
2012-09-17  0:38 ` [ 104/135] staging: zcache: fix cleancache race condition with shrinker Ben Hutchings
2012-09-17  0:38 ` [ 105/135] xhci: Switch PPT ports to EHCI on shutdown Ben Hutchings
2012-09-17  0:38 ` [ 106/135] xhci: Fix a logical vs bitwise AND bug Ben Hutchings
2012-09-17  0:38 ` [ 107/135] xhci: Make handover code more robust Ben Hutchings
2012-09-17  0:38 ` [ 108/135] usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware Ben Hutchings
2012-09-17  0:38 ` [ 109/135] usb: host: xhci: fix compilation error for non-PCI based stacks Ben Hutchings
2012-09-17  0:38 ` [ 110/135] tty: serial: imx: console write routing is unsafe on SMP Ben Hutchings
2012-09-17  0:38 ` [ 111/135] tty: serial: imx: dont reinit clock in imx_setup_ufcr() Ben Hutchings
2012-09-17  0:38 ` Ben Hutchings [this message]
2012-09-17  0:38 ` [ 113/135] USB: ftdi-sio: add support for more Physik Instrumente devices Ben Hutchings
2012-09-17  0:38 ` [ 114/135] USB: ftdi_sio: PID for NZR SEM 16+ USB Ben Hutchings
2012-09-17  0:38 ` [ 115/135] USB: add device quirk for Joss Optical touchboard Ben Hutchings
2012-09-17  0:38 ` [ 116/135] kobject: fix oops with "input0: bad kobj_uevent_env content in show_uevent()" Ben Hutchings
2012-09-17  0:38 ` [ 117/135] NFS: return error from decode_getfh in decode open Ben Hutchings
2012-09-19  1:26   ` Herton Ronaldo Krzesinski
2012-09-19  3:39     ` Ben Hutchings
2012-09-19 15:53       ` Myklebust, Trond
2012-09-20  1:21         ` Ben Hutchings
2012-09-17  0:38 ` [ 118/135] SUNRPC: Fix a UDP transport regression Ben Hutchings
2012-09-17  0:38 ` [ 119/135] ARM: 7513/1: Make sure dtc is built before running it Ben Hutchings
2012-09-17  0:38 ` [ 120/135] ARM: 7526/1: traps: send SIGILL if get_user fails on undef handling path Ben Hutchings
2012-09-17  0:38 ` [ 121/135] ALSA: hda - Fix Oops at codec reset/reconfig Ben Hutchings
2012-09-17  0:38 ` [ 122/135] USB: ftdi_sio: do not claim CDC ACM function Ben Hutchings
2012-09-17  0:38 ` [ 123/135] staging: r8712u: fix bug in r8712_recv_indicatepkt() Ben Hutchings
2012-09-17  0:38 ` [ 124/135] EHCI: Update qTD next pointer in QH overlay region during unlink Ben Hutchings
2012-09-17  0:38 ` [ 125/135] hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements Ben Hutchings
2012-09-17  0:38 ` [ 126/135] ALSA: ice1724: Use linear scale for AK4396 volume control Ben Hutchings
2012-09-17  0:38 ` [ 127/135] vmwgfx: add dumb ioctl support Ben Hutchings
2012-09-17  0:38 ` [ 128/135] ahci: Add alternate identifier for the 88SE9172 Ben Hutchings
2012-09-17  0:38 ` [ 129/135] drm/radeon: fix up pll selection on DCE5/6 Ben Hutchings
2012-09-17  0:38 ` [ 130/135] drm/radeon: fix ordering in pll picking on dce4+ Ben Hutchings
2012-09-17  0:38 ` [ 131/135] drm/radeon: rework pll selection (v3) Ben Hutchings
2012-09-17  0:38 ` [ 132/135] drm/nouveau: fix booting with plymouth + dumb support Ben Hutchings
2012-09-17  0:38 ` [ 133/135] eCryptfs: Copy up attributes of the lower target inode after rename Ben Hutchings
2012-09-17  0:38 ` [ 134/135] VFS: make vfs_fstat() use f[get|put]_light() Ben Hutchings
2012-09-17  0:38 ` [ 135/135] vfs: make O_PATH file descriptors usable for fstat() Ben Hutchings
2012-09-17  0:53 ` [ 000/135] 3.2.30-stable review Ben Hutchings

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=20120917003641.721250035@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=santil@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome