]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.44/media-vb2-fix-videobuf2-to-map-correct-area.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.44 / media-vb2-fix-videobuf2-to-map-correct-area.patch
CommitLineData
06e23a17
GKH
1From foo@baz Thu May 24 11:09:34 CEST 2018
2From: Masami Hiramatsu <mhiramat@kernel.org>
3Date: Tue, 6 Feb 2018 03:02:23 -0500
4Subject: media: vb2: Fix videobuf2 to map correct area
5
6From: Masami Hiramatsu <mhiramat@kernel.org>
7
8[ Upstream commit d13a0139d7874a0577b5955d6eed895517d23b72 ]
9
10Fixes vb2_vmalloc_get_userptr() to ioremap correct area.
11Since the current code does ioremap the page address, if the offset > 0,
12it does not do ioremap the last page and results in kernel panic.
13
14This fixes to pass the size + offset to ioremap so that ioremap
15can map correct area. Also, this uses __pfn_to_phys() to get the physical
16address of given PFN.
17
18Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
19Reported-by: Takao Orito <orito.takao@socionext.com>
20Reported-by: Fumihiro ATSUMI <atsumi@infinitegra.co.jp>
21Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
22Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
23Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
24Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
25Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26---
27 drivers/media/v4l2-core/videobuf2-vmalloc.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
31+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
32@@ -106,7 +106,7 @@ static void *vb2_vmalloc_get_userptr(str
33 if (nums[i-1] + 1 != nums[i])
34 goto fail_map;
35 buf->vaddr = (__force void *)
36- ioremap_nocache(nums[0] << PAGE_SHIFT, size);
37+ ioremap_nocache(__pfn_to_phys(nums[0]), size + offset);
38 } else {
39 buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1,
40 PAGE_KERNEL);