From: Andrew Morton <akpm@linux-foundation.org>
To: Gianfranco Trad <gianf.trad@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, skhan@linuxfoundation.org,
syzbot+4089e577072948ac5531@syzkaller.appspotmail.com,
willy@infradead.org
Subject: Re: [PATCH v2] Fix NULL pointer dereference in read_cache_folio
Date: Mon, 30 Sep 2024 10:02:34 -0700 [thread overview]
Message-ID: <20240930100234.f7e91af05adeea036e0be8cc@linux-foundation.org> (raw)
In-Reply-To: <20240930090225.28517-2-gianf.trad@gmail.com>
On Mon, 30 Sep 2024 11:02:26 +0200 Gianfranco Trad <gianf.trad@gmail.com> wrote:
> Add check on filler to prevent NULL pointer dereference condition in
> read_cache_folio[1].
>
> [1] https://syzkaller.appspot.com/bug?extid=4089e577072948ac5531
Test case https://syzkaller.appspot.com/x/repro.c?x=10a0d880580000
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 4f3753f0a158..88de8029133c 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2360,6 +2360,8 @@ static int filemap_read_folio(struct file *file, filler_t filler,
> /* Start the actual read. The read will unlock the page. */
> if (unlikely(workingset))
> psi_memstall_enter(&pflags);
> + if (!filler)
> + return -EIO;
> error = filler(file, folio);
> if (unlikely(workingset))
> psi_memstall_leave(&pflags);
do_read_cache_folio() already handles a NULL filler (from
freader_get_folio()'s read_cache_folio() call).
if (!filler)
filler = mapping->a_ops->read_folio;
so I'm suspecting that an appropriate fix is to teach the underlying
address_space_operations (appears to be from /proc/pid/maps) to
implement ->read_folio().
next prev parent reply other threads:[~2024-09-30 17:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-29 23:05 [PATCH v1] " Gianfranco Trad
2024-09-30 9:02 ` [PATCH v2] " Gianfranco Trad
2024-09-30 17:02 ` Andrew Morton [this message]
2024-09-30 18:14 ` Matthew Wilcox
2024-10-04 12:07 ` Gianfranco Trad
2024-10-15 11:57 ` [PATCH v2] mm: fix null " Gianfranco Trad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240930100234.f7e91af05adeea036e0be8cc@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=gianf.trad@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+4089e577072948ac5531@syzkaller.appspotmail.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox