[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211112124411.1948809-5-roberto.sassu@huawei.com>
Date: Fri, 12 Nov 2021 13:44:10 +0100
From: Roberto Sassu <roberto.sassu@...wei.com>
To: <ebiggers@...nel.org>, <tytso@....edu>, <corbet@....net>,
<viro@...iv.linux.org.uk>, <hughd@...gle.com>,
<akpm@...ux-foundation.org>
CC: <linux-fscrypt@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-integrity@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: [RFC][PATCH 4/5] shmem: Avoid segfault in shmem_read_mapping_page_gfp()
Check the hwpoison page flag only if the page is valid in
shmem_read_mapping_page_gfp(). The PageHWPoison() macro tries to access
the page flags and cannot work on an error pointer.
Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 23c91a8beb78..427863cbf0dc 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4222,7 +4222,7 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
else
unlock_page(page);
- if (PageHWPoison(page))
+ if (!IS_ERR(page) && PageHWPoison(page))
page = ERR_PTR(-EIO);
return page;
--
2.32.0
Powered by blists - more mailing lists