All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: stable@vger.kernel.org, stable-commits@vger.kernel.org
Cc: Honggang LI <honli@redhat.com>,
	Doug Ledford <dledford@redhat.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: [added to the 3.18 stable tree] mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures
Date: Mon, 22 Jun 2015 00:13:21 -0400	[thread overview]
Message-ID: <1434946411-9021-55-git-send-email-sasha.levin@oracle.com> (raw)
In-Reply-To: <1434946411-9021-1-git-send-email-sasha.levin@oracle.com>

From: Honggang LI <honli@redhat.com>

This patch has been added to the 3.18 stable tree. If you have any
objections, please let us know.

===============

[ Upstream commit 59d2d18cc4e9ba30b370db18d0e02d792699da96 ]

If CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for x86 systems and physical
memory is more than 4GB, dma_map_page may return a valid memory
address which greater than 0xffffffff. As a result, the mlx5 device page
allocator RB tree will be initialized with valid addresses greater than
0xfffffff.

However, (addr & PAGE_MASK) set the high four bytes to zeros. So, it's
impossible for the function, free_4k, to release the pages whose
addresses greater than 4GB. Memory leaks. And mlx5_ib module can't
release the pages when user try to remove the module, as a result,
system hang.

[root@rdma05 root]# dmesg  | grep addr | head
addr             = 3fe384000
addr & PAGE_MASK =  fe384000
[root@rdma05 root]# rmmod mlx5_ib   <---- hang on

---------------------- cosnole log -----------------
mlx5_ib 0000:04:00.0: irq 138 for MSI/MSI-X
  alloc irq_desc for 139 on node -1
  alloc kstat_irqs on node -1
mlx5_ib 0000:04:00.0: irq 139 for MSI/MSI-X
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
---------------------- cosnole log -----------------

Fixes: bf0bf77f6519 ('mlx5: Support communicating arbitrary host page size to firmware')
Signed-off-by: Honggang Li <honli@redhat.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index d476918..aa78f07 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -211,26 +211,28 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	return 0;
 }
 
+#define MLX5_U64_4K_PAGE_MASK ((~(u64)0U) << PAGE_SHIFT)
+
 static void free_4k(struct mlx5_core_dev *dev, u64 addr)
 {
 	struct fw_page *fwp;
 	int n;
 
-	fwp = find_fw_page(dev, addr & PAGE_MASK);
+	fwp = find_fw_page(dev, addr & MLX5_U64_4K_PAGE_MASK);
 	if (!fwp) {
 		mlx5_core_warn(dev, "page not found\n");
 		return;
 	}
 
-	n = (addr & ~PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;
+	n = (addr & ~MLX5_U64_4K_PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;
 	fwp->free_count++;
 	set_bit(n, &fwp->bitmask);
 	if (fwp->free_count == MLX5_NUM_4K_IN_PAGE) {
 		rb_erase(&fwp->rb_node, &dev->priv.page_root);
 		if (fwp->free_count != 1)
 			list_del(&fwp->list);
-		dma_unmap_page(&dev->pdev->dev, addr & PAGE_MASK, PAGE_SIZE,
-			       DMA_BIDIRECTIONAL);
+		dma_unmap_page(&dev->pdev->dev, addr & MLX5_U64_4K_PAGE_MASK,
+			       PAGE_SIZE, DMA_BIDIRECTIONAL);
 		__free_page(fwp->page);
 		kfree(fwp);
 	} else if (fwp->free_count == 1) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe stable" in

  parent reply	other threads:[~2015-06-22  4:14 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22  4:12 [added to the 3.18 stable tree] sched, numa: Do not hint for NUMA balancing on VM_MIXEDMAP mappings Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] Drivers: hv: vmbus: Add support for VMBus panic notifier handler Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] ARM: shmobile: r8a7791: add USBDMAC{0,1} clocks to device tree Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] ARM: shmobile: r8a7791: Correct SDHI clock labels and output-names Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] xtensa: xtfpga: fix hardware lockup caused by LCD driver Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] serial: imx: Enable UCR4_OREN in startup interface Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] serial: imx: Fix clearing of receiver overrun flag Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] pinctrl: remove maxpin from documentation Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] ARM: shmobile: r8a7790: Correct SYSCIER value Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] ARM: shmobile: r8a7791: " Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] arm64: kill off the libgcc dependency Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] arm64: Adjust EFI libstub object include logic Sasha Levin
2015-06-22 15:47   ` Kevin Hilman
2015-06-22 15:47     ` Kevin Hilman
2015-06-22  4:12 ` [added to the 3.18 stable tree] pinctrl: remove enable/disable callbacks from documentation Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] pinctrl: remove doc mention of the enable/disable API Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] pinctrl: fix example .get_group_pins implementation signature Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: kye: Fix report descriptor for Genius PenSketch M912 Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: uclogic: Set quirks from inside the driver Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: saitek: add USB ID for older R.A.T. 7 Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: microsoft: Add ID for NE7K wireless keyboard Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: Introduce hidpp, a module to handle Logitech hid++ devices Sasha Levin
2015-06-22 14:16   ` Benjamin Tissoires
2015-06-23 14:24     ` Sasha Levin
2015-06-23 19:24       ` Benjamin Tissoires
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: add ALWAYS_POLL quirk for a Logitech 0xc007 Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: add HP OEM mouse to quirk ALWAYS_POLL Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: add quirk for PIXART OEM mouse used by HP Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: usbhid: more mice with ALWAYS_POLL Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: usbhid: yet another mouse " Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: usbhid: Add a quirk for raphnet multi-gamepad adapters Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: sjoy: support Super Joy Box 4 Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] HID: usbhid: Add HID_QUIRK_NOGET for Aten DVI KVM switch Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] iommu/vt-d: Allow RMRR on graphics devices too Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] ACPI: Add support for device specific properties Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] Driver core: Unified device properties interface for platform firmware Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] serial: 8250: add support for ACPI-probed serial port for X-Gene platform Sasha Levin
2015-06-22  4:12 ` [added to the 3.18 stable tree] serial: 8250_dw: add support for AMD SOC Carrizo Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] stable_kernel_rules: Add clause about specification of kernel versions to patch Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] xprtrdma: Take struct ib_device_attr off the stack Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] xprtrdma: Prevent infinite loop in rpcrdma_ep_create() Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] inet: add TCP_NEW_SYN_RECV state Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] net: add sk_fullsock() helper Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] netfilter: x_tables: fix cgroup matching on non-full sks Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] ext4: fix bh leak on error paths in ext4_rename() and ext4_cross_rename() Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] jhash: Update jhash_[321]words functions to use correct initval Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] vti6: fix uninit when using x-netns Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] usb: dwc2: hcd: use new USB_RESUME_TIMEOUT Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] [media] Add and use IS_REACHABLE macro Sasha Levin
2015-06-23 10:11   ` Arnd Bergmann
2015-06-23 14:26     ` Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] RDS: Documentation: Document AF_RDS, PF_RDS and SOL_RDS correctly Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_NEWSPDINFO Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_GETSPDINFO Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_[NEW|GET]SADINFO Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] x86/iommu: Fix header comments regarding standard and _FINISH macros Sasha Levin
2015-06-22  7:09   ` Borislav Petkov
2015-06-22  4:13 ` [added to the 3.18 stable tree] mnt: Fix the error check in __detach_mounts Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] MIPS: unaligned: Fix regular load/store instruction emulation for EVA Sasha Levin
2015-06-22  4:13   ` Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_REPORT Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_MIGRATE Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] selinux/nlmsg: add XFRM_MSG_MAPPING Sasha Levin
2015-06-22  4:13 ` Sasha Levin [this message]
2015-06-22  4:13 ` [added to the 3.18 stable tree] firmware/ihex2fw.c: restore missing default in switch statement Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] efivarfs: Ensure VariableName is NUL-terminated Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] tcp: tcp_get_info() should fetch socket fields once Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] dmaengine: shdmac: avoid unused variable warnings Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] spi: bitbang: Make setup_transfer() callback optional Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] x86: Clean up cr4 manipulation Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] x86: Store a per-cpu shadow copy of CR4 Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] KVM: VMX: Preserve host CR4.MCE value while in guest mode Sasha Levin
2015-06-22  4:13 ` [added to the 3.18 stable tree] kernel: make READ_ONCE() valid on const arguments Sasha Levin

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=1434946411-9021-55-git-send-email-sasha.levin@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=dledford@redhat.com \
    --cc=honli@redhat.com \
    --cc=stable-commits@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.