]>
Commit | Line | Data |
---|---|---|
06e23a17 GKH |
1 | From foo@baz Thu May 24 11:09:34 CEST 2018 |
2 | From: Masami Hiramatsu <mhiramat@kernel.org> | |
3 | Date: Tue, 6 Feb 2018 03:02:23 -0500 | |
4 | Subject: media: vb2: Fix videobuf2 to map correct area | |
5 | ||
6 | From: Masami Hiramatsu <mhiramat@kernel.org> | |
7 | ||
8 | [ Upstream commit d13a0139d7874a0577b5955d6eed895517d23b72 ] | |
9 | ||
10 | Fixes vb2_vmalloc_get_userptr() to ioremap correct area. | |
11 | Since the current code does ioremap the page address, if the offset > 0, | |
12 | it does not do ioremap the last page and results in kernel panic. | |
13 | ||
14 | This fixes to pass the size + offset to ioremap so that ioremap | |
15 | can map correct area. Also, this uses __pfn_to_phys() to get the physical | |
16 | address of given PFN. | |
17 | ||
18 | Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> | |
19 | Reported-by: Takao Orito <orito.takao@socionext.com> | |
20 | Reported-by: Fumihiro ATSUMI <atsumi@infinitegra.co.jp> | |
21 | Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> | |
22 | Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> | |
23 | Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> | |
24 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
25 | Signed-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); |