[PATCH] mm: Fix a null ptr deref with CONFIG_DEBUG_VM enabled in wp_page_reuse

Zack Rusin zackr at vmware.com
Wed Jul 27 19:31:34 UTC 2022


On Wed, 2022-07-27 at 20:24 +0100, Matthew Wilcox wrote:
> On Wed, Jul 27, 2022 at 03:14:07PM -0400, Zack Rusin wrote:
> > From: Zack Rusin <zackr at vmware.com>
> > 
> > Write page faults on last references might not have a valid page anymore.
> > wp_page_reuse has always dealt with that scenario by making
> > sure the page isn't null (or the reference was shared) before doing
> > anything with it. Recently added checks in VM_BUG_ON (enabled by the
> > CONFIG_DEBUG_VM option) use PageAnon helpers which assume the passed
> > page is never null, before making sure there is a valid page to work
> > with.
> > 
> > Move the VM_BUG_ON, which unconditionally uses the page, after the
> > code that checks that we have a valid one.
> 
> Message-ID: <CAHk-=wh_TrgNm6vz7=7CgZppr0UrZ9TwLyb3dgPXyG-w=a8kJQ at mail.gmail.com>

Ah, great, thanks.

z


More information about the dri-devel mailing list