Thread (18 messages) 18 messages, 3 authors, 2021-10-20

Re: [v4 PATCH 5/6] mm: shmem: don't truncate page if memory failure happens

From: Naoya Horiguchi <hidden>
Date: 2021-10-19 22:30:21
Also in: linux-fsdevel, lkml

On Tue, Oct 19, 2021 at 10:29:51AM -0700, Yang Shi wrote:
On Mon, Oct 18, 2021 at 10:52 PM Naoya Horiguchi
[off-list ref] wrote:
quoted
On Thu, Oct 14, 2021 at 12:16:14PM -0700, Yang Shi wrote:
...
quoted
quoted
@@ -2466,7 +2467,15 @@ shmem_write_begin(struct file *file, struct address_space *mapping,
                      return -EPERM;
      }

-     return shmem_getpage(inode, index, pagep, SGP_WRITE);
+     ret = shmem_getpage(inode, index, pagep, SGP_WRITE);
+
+     if (*pagep && PageHWPoison(*pagep)) {
shmem_getpage() could return with pagep == NULL, so you need check ret first
to avoid NULL pointer dereference.
Realy? IIUC pagep can't be NULL. It is a pointer's pointer passed in
by the caller, for example, generic_perform_write(). Of course,
"*pagep" could be NULL.
Oh, I simply missed this. You're right. Please ignore my comment on this.

- Naoya Horiguchi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help