From: Matthew Wilcox <willy@infradead.org>
To: Deepanshu Kartikey <kartikey406@gmail.com>
Cc: agruenba@redhat.com, gfs2@lists.linux.dev,
linux-kernel@vger.kernel.org,
syzbot+9013411dc43f3582823a@syzkaller.appspotmail.com
Subject: Re: [PATCH] gfs2: fix hung task in gfs2_jhead_process_page
Date: Tue, 24 Mar 2026 14:46:13 +0000 [thread overview]
Message-ID: <acKjtaMVQS_d0Esi@casper.infradead.org> (raw)
In-Reply-To: <20260324033959.1456418-1-kartikey406@gmail.com>
On Tue, Mar 24, 2026 at 09:09:59AM +0530, Deepanshu Kartikey wrote:
> filemap_get_folio() returns an ERR_PTR if the folio is not present
> in the page cache. gfs2_jhead_process_page() does not check the
> return value and passes it directly to folio_wait_locked(), causing
> the kernel task to get stuck in uninterruptible sleep (state D)
> forever, triggering the hung task watchdog.
>
> This can be triggered by mounting a crafted or corrupted GFS2
> filesystem image.
>
> Fix this by checking the return value of filemap_get_folio() and
> returning early if the folio is not found.
>
> Fixes: 240159077d00 ("gfs2: Convert gfs2_jhead_process_page() to use a folio")
No. That commit only changed the code, it didn't introduce the bug.
f4686c26ecc3 may have introduced it, but I wouldn't swear to it.
I have my doubts that this is the right fix. If you look at the entire
function, it assumes that the folio was already created and added to
the page cache. The error should surely be detected earlier, not by
this function.
> Reported-by: syzbot+9013411dc43f3582823a@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=9013411dc43f3582823a
> Signed-off-by: Deepanshu Kartikey <Kartikey406@gmail.com>
> ---
> fs/gfs2/lops.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
> index 797931eb5845..005584311eff 100644
> --- a/fs/gfs2/lops.c
> +++ b/fs/gfs2/lops.c
> @@ -467,6 +467,9 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
>
> folio = filemap_get_folio(jd->jd_inode->i_mapping, index);
>
> + if (IS_ERR(folio))
> + return;
> +
> folio_wait_locked(folio);
> if (!folio_test_uptodate(folio))
> *done = true;
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-03-24 14:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 3:39 [PATCH] gfs2: fix hung task in gfs2_jhead_process_page Deepanshu Kartikey
2026-03-24 14:46 ` Matthew Wilcox [this message]
2026-03-25 0:06 ` Deepanshu Kartikey
2026-03-25 1:42 ` Andreas Gruenbacher
2026-03-25 23:54 ` Deepanshu Kartikey
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=acKjtaMVQS_d0Esi@casper.infradead.org \
--to=willy@infradead.org \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=kartikey406@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+9013411dc43f3582823a@syzkaller.appspotmail.com \
/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