Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1505731

[PATCH 4.7 14/45] drivers: base: dma-mapping: page align the size when unmap_kernel_range

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.7 14/45] drivers: base: dma-mapping: page align the size when unmap_kernel_range
Date 2016-10-21 11:50 +0200
Message-ID <suECB-3Ib-21@gated-at.bofh.it> (permalink)
References <suE9A-3xe-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

From: Peng Fan <van.freenix@gmail.com>

commit 85714108e673cdebf1b96abfd50fb02a29e37577 upstream.

When dma_common_free_remap, the input parameter 'size' may not
be page aligned. And, met kernel warning when doing iommu dma
for usb on i.MX8 platform:
"
WARNING: CPU: 0 PID: 869 at mm/vmalloc.c:70 vunmap_page_range+0x1cc/0x1d0()
Modules linked in:
CPU: 0 PID: 869 Comm: kworker/u8:2 Not tainted 4.1.12-00444-gc5f9d1d-dirty #147
Hardware name: Freescale i.MX8DV Sabreauto (DT)
Workqueue: ci_otg ci_otg_work
Call trace:
[<ffffffc000089920>] dump_backtrace+0x0/0x124
[<ffffffc000089a54>] show_stack+0x10/0x1c
[<ffffffc0006d1e6c>] dump_stack+0x84/0xc8
[<ffffffc0000b4568>] warn_slowpath_common+0x98/0xd0
[<ffffffc0000b4664>] warn_slowpath_null+0x14/0x20
[<ffffffc000170348>] vunmap_page_range+0x1c8/0x1d0
[<ffffffc000170388>] unmap_kernel_range+0x20/0x88
[<ffffffc000460ad0>] dma_common_free_remap+0x74/0x84
[<ffffffc0000940d8>] __iommu_free_attrs+0x9c/0x178
[<ffffffc0005032bc>] ehci_mem_cleanup+0x140/0x194
[<ffffffc000503548>] ehci_stop+0x8c/0xdc
[<ffffffc0004e8258>] usb_remove_hcd+0xf0/0x1cc
[<ffffffc000516bc0>] host_stop+0x1c/0x58
[<ffffffc000514240>] ci_otg_work+0xdc/0x120
[<ffffffc0000c9c34>] process_one_work+0x134/0x33c
[<ffffffc0000c9f78>] worker_thread+0x13c/0x47c
[<ffffffc0000cf43c>] kthread+0xd8/0xf0
"

For dma_common_pages_remap:
dma_common_pages_remap
   |->get_vm_area_caller
        |->__get_vm_area_node
            |->size = PAGE_ALIGN(size);   Round up to page aligned

So, in dma_common_free_remap, we also need a page aligned size,
pass 'PAGE_ALIGN(size)' to unmap_kernel_range.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/base/dma-mapping.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -334,7 +334,7 @@ void dma_common_free_remap(void *cpu_add
 		return;
 	}
 
-	unmap_kernel_range((unsigned long)cpu_addr, size);
+	unmap_kernel_range((unsigned long)cpu_addr, PAGE_ALIGN(size));
 	vunmap(cpu_addr);
 }
 #endif

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.7 00/45] 4.7.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 06/45] debugfs: introduce a public file_operations accessor Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 44/45] cachefiles: Fix attempt to read i_blocks after deleting file [ver #2] Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 38/45] ext4: release bh in make_indexed_dir Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 33/45] ext4: enforce online defrag restriction for encrypted files Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 45/45] cfq: fix starvation of asynchronous writes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 08/45] b43legacy: fix debugfs crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:40 +0200
  [PATCH 4.7 20/45] fuse: fix killing s[ug]id in setattr Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 21/45] i40e: avoid NULL pointer dereference and recursive errors on early PCI error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 14/45] drivers: base: dma-mapping: page align the size when unmap_kernel_range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 02/45] serial: 8250_dw: Check the data->pclk when get apb_pclk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 30/45] scsi: arcmsr: Simplify user_len checking Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 29/45] scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 05/45] ARCv2: fix local_save_flags Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 17/45] clk: mvebu: dynamically allocate resources in Armada CP110 system controller Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 23/45] brcmfmac: fix pmksa->bssid usage Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  [PATCH 4.7 15/45] IB/hfi1: Fix defered ack race with qp destroy Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-21 11:50 +0200
  Re: [PATCH 4.7 00/45] 4.7.10-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-10-21 17:50 +0200
  Re: [PATCH 4.7 00/45] 4.7.10-stable review Guenter Roeck <linux@roeck-us.net> - 2016-10-21 21:20 +0200
  Re: [PATCH 4.7 00/45] 4.7.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-22 12:00 +0200

csiph-web