All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+5a5f492ccae698fd7434@syzkaller.appspotmail.com>
To: founder@logarcheon.com
Cc: founder@logarcheon.com, syzkaller-bugs@googlegroups.com,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gfs2: Fix NULL pointer dereference in gfs2_seek_data/gfs2_seek_hole
Date: Mon, 16 Nov 2026 09:54:06 -0800	[thread overview]
Message-ID: <6afb433e.f3cfa7c9.844a4.0000.GAE@google.com> (raw)
In-Reply-To: <20261116175346.44221-1-founder@logarcheon.com>

> #syz test

Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.

>
> When the filesystem has been withdrawn, gfs2_glock_nq() returns -EIO
> without queuing the holder, and gfs2_glock_nq_init() then calls
> gfs2_holder_uninit(), which sets gh.gh_gl to NULL.
>
> gfs2_seek_data() and gfs2_seek_hole() call gfs2_glock_dq_uninit()
> unconditionally, so in that case gfs2_glock_dq() dereferences a NULL
> glock when it takes gl->gl_lockref.lock, causing a general protection
> fault.
>
> Only release the holder when it was successfully acquired, matching the
> pattern already used elsewhere in this file (such as gfs2_fiemap() and
> gfs2_getattr()).
>
> Reported-by: syzbot+5a5f492ccae698fd7434@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5a5f492ccae698fd7434
> Signed-off-by: William Chuang <founder@logarcheon.com>
> ---
>  fs/gfs2/inode.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
> index 75fb1a0..4110b2d 100644
> --- a/fs/gfs2/inode.c
> +++ b/fs/gfs2/inode.c
> @@ -2255,7 +2255,8 @@ loff_t gfs2_seek_data(struct file *file, loff_t offset)
>  	ret = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &gh);
>  	if (!ret)
>  		ret = iomap_seek_data(inode, offset, gfs2_iomap_next);
> -	gfs2_glock_dq_uninit(&gh);
> +	if (gfs2_holder_initialized(&gh))
> +		gfs2_glock_dq_uninit(&gh);
>  	inode_unlock_shared(inode);
>  
>  	if (ret < 0)
> @@ -2274,7 +2275,8 @@ loff_t gfs2_seek_hole(struct file *file, loff_t offset)
>  	ret = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &gh);
>  	if (!ret)
>  		ret = iomap_seek_hole(inode, offset, gfs2_iomap_next);
> -	gfs2_glock_dq_uninit(&gh);
> +	if (gfs2_holder_initialized(&gh))
> +		gfs2_glock_dq_uninit(&gh);
>  	inode_unlock_shared(inode);
>  
>  	if (ret < 0)
> -- 
> 2.43.0
>
>

       reply	other threads:[~2026-11-16 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261116175346.44221-1-founder@logarcheon.com>
2026-11-16 17:54 ` syzbot [this message]
2026-11-16 18:00 [PATCH] gfs2: Fix NULL pointer dereference in gfs2_seek_data/gfs2_seek_hole William Chuang
2026-11-16 22:08 ` Andreas Gruenbacher

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=6afb433e.f3cfa7c9.844a4.0000.GAE@google.com \
    --to=syzbot+5a5f492ccae698fd7434@syzkaller.appspotmail.com \
    --cc=founder@logarcheon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.