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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 19, 2021 at 10:29:51AM -0700, Yang Shi wrote:
> On Mon, Oct 18, 2021 at 10:52 PM Naoya Horiguchi
> <naoya.horiguchi@xxxxxxxxx> wrote:
> >
> > On Thu, Oct 14, 2021 at 12:16:14PM -0700, Yang Shi wrote:
...
> > > @@ -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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux