提交 d13a0139 编写于 作者: M Masami Hiramatsu 提交者: Mauro Carvalho Chehab

media: vb2: Fix videobuf2 to map correct area

Fixes vb2_vmalloc_get_userptr() to ioremap correct area.
Since the current code does ioremap the page address, if the offset > 0,
it does not do ioremap the last page and results in kernel panic.

This fixes to pass the size + offset to ioremap so that ioremap
can map correct area. Also, this uses __pfn_to_phys() to get the physical
address of given PFN.
Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
Reported-by: NTakao Orito <orito.takao@socionext.com>
Reported-by: NFumihiro ATSUMI <atsumi@infinitegra.co.jp>
Reviewed-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 14351d44
...@@ -106,7 +106,7 @@ static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr, ...@@ -106,7 +106,7 @@ static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr,
if (nums[i-1] + 1 != nums[i]) if (nums[i-1] + 1 != nums[i])
goto fail_map; goto fail_map;
buf->vaddr = (__force void *) buf->vaddr = (__force void *)
ioremap_nocache(nums[0] << PAGE_SHIFT, size); ioremap_nocache(__pfn_to_phys(nums[0]), size + offset);
} else { } else {
buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1, buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1,
PAGE_KERNEL); PAGE_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册