Commit 24eee1e4 authored by's avatar Committed by Linus Torvalds

mm/memory.c: check return value of ioremap_prot

ioremap_prot() can return NULL which could lead to an oops.

Link: default avatarchen jie <>
Reviewed-by: default avatarAndrew Morton <>
Cc: Li Zefan <>
Cc: chenjie <>
Cc: Yang Shi <>
Cc: Alexey Dobriyan <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 3ca17b1f
......@@ -4395,6 +4395,9 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
return -EINVAL;
maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
if (!maddr)
return -ENOMEM;
if (write)
memcpy_toio(maddr + offset, buf, len);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment