[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180903165639.615094995@linuxfoundation.org>
Date: Mon, 3 Sep 2018 18:56:12 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, chen jie <chenjie6@...wei.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Li Zefan <lizefan@...wei.com>, Yang Shi <shy828301@...il.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sasha Levin <alexander.levin@...rosoft.com>
Subject: [PATCH 4.9 048/107] mm/memory.c: check return value of ioremap_prot
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "jie@...njie6@...ei.com" <jie@...njie6@...ei.com>
[ Upstream commit 24eee1e4c47977bdfb71d6f15f6011e7b6188d04 ]
ioremap_prot() can return NULL which could lead to an oops.
Link: http://lkml.kernel.org/r/1533195441-58594-1-git-send-email-chenjie6@huawei.com
Signed-off-by: chen jie <chenjie6@...wei.com>
Reviewed-by: Andrew Morton <akpm@...ux-foundation.org>
Cc: Li Zefan <lizefan@...wei.com>
Cc: chenjie <chenjie6@...wei.com>
Cc: Yang Shi <shy828301@...il.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@...rosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
mm/memory.c | 3 +++
1 file changed, 3 insertions(+)
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3861,6 +3861,9 @@ int generic_access_phys(struct vm_area_s
return -EINVAL;
maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
+ if (!maddr)
+ return -ENOMEM;
+
if (write)
memcpy_toio(maddr + offset, buf, len);
else
Powered by blists - more mailing lists