From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Peng Fan <van.freenix@gmail.com>
Subject: [PATCH 4.4 03/25] drivers: base: dma-mapping: page align the size when unmap_kernel_range
Date: Fri, 21 Oct 2016 11:15:54 +0200 [thread overview]
Message-ID: <20161021091413.380996707@linuxfoundation.org> (raw)
In-Reply-To: <20161021091413.053290730@linuxfoundation.org>
4.4-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
@@ -335,7 +335,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
next prev parent reply other threads:[~2016-10-21 9:17 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161021091628uscas1p21e03f35d4481162f8066d9056c8aeb3c@uscas1p2.samsung.com>
2016-10-21 9:15 ` [PATCH 4.4 00/25] 4.4.27-stable review Greg Kroah-Hartman
2016-10-21 9:15 ` [PATCH 4.4 01/25] serial: 8250_dw: Check the data->pclk when get apb_pclk Greg Kroah-Hartman
2016-10-21 9:15 ` [PATCH 4.4 02/25] btrfs: assign error values to the correct bio structs Greg Kroah-Hartman
2016-10-21 9:15 ` Greg Kroah-Hartman [this message]
2016-10-21 9:15 ` [PATCH 4.4 04/25] fuse: listxattr: verify xattr list Greg Kroah-Hartman
2016-10-21 9:15 ` [PATCH 4.4 06/25] fuse: fix killing s[ug]id in setattr Greg Kroah-Hartman
2016-10-21 9:15 ` [PATCH 4.4 07/25] i40e: avoid NULL pointer dereference and recursive errors on early PCI error Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 09/25] ASoC: Intel: Atom: add a missing star in a memcpy call Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 10/25] reiserfs: Unlock superblock before calling reiserfs_quota_on_mount() Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 11/25] reiserfs: switch to generic_{get,set,remove}xattr() Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 12/25] async_pq_val: fix DMA memory leak Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 13/25] scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer() Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 14/25] scsi: arcmsr: Simplify user_len checking Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 15/25] scsi: ibmvfc: Fix I/O hang when port is not mapped Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 16/25] ext4: enforce online defrag restriction for encrypted files Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 17/25] ext4: reinforce check of i_dtime when clearing high fields of uid and gid Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 18/25] ext4: fix memory leak in ext4_insert_range() Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 19/25] ext4: allow DAX writeback for hole punch Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 20/25] ext4: release bh in make_indexed_dir Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 21/25] crypto: ghash-generic - move common definitions to a new header file Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 22/25] crypto: vmx - Fix memory corruption caused by p8_ghash Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 23/25] dlm: free workqueues after the connections Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 24/25] vfs: move permission checking into notify_change() for utimes(NULL) Greg Kroah-Hartman
2016-10-21 9:16 ` [PATCH 4.4 25/25] cfq: fix starvation of asynchronous writes Greg Kroah-Hartman
2016-10-21 15:44 ` [PATCH 4.4 00/25] 4.4.27-stable review Shuah Khan
2016-10-21 19:16 ` Guenter Roeck
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=20161021091413.380996707@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=van.freenix@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).