mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Chinner <dgc@kernel.org>
To: Eduard Zateev <hackerowskiy@gmail.com>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+9d8e687768d0f38c1f09@syzkaller.appspotmail.com
Subject: Re: [PATCH] xfs: preserve buffer item with outstanding references
Date: Wed, 21 Oct 2026 07:55:54 +1100	[thread overview]
Message-ID: <atfVWiDCE2LSOBMU@dread> (raw)
In-Reply-To: <20261020200433.3298861-1-hackerowskiy@gmail.com>

On Tue, Oct 20, 2026 at 10:04:31PM +0200, Eduard Zateev wrote:
> The buffer log item can still be referenced by the CIL after the buffer's
> synchronous write completes.  In this case xfs_buf_item_relse() is called
> from xfs_buf_ioend() with bli_refcount non-zero.  Freeing the item leaves
> a stale pointer in the CIL, which xlog_cil_committed() later dereferences.
> 
> Restore the reference-count check removed by commit d2fe5c4c8d25
> ("xfs: rearrange code in xfs_buf_item.c").  If references remain, keep
> the log item attached to the buffer so that its final reference release
> can perform cleanup.
> 
> Build-tested: fs/xfs/xfs_buf_item.o (ARCH=arm64, W=1).
> The syzbot report does not include a reproducer, so runtime testing was
> not possible.
> 
> Fixes: d2fe5c4c8d25 ("xfs: rearrange code in xfs_buf_item.c")
> Reported-by: syzbot+9d8e687768d0f38c1f09@syzkaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=9d8e687768d0f38c1f09
> Assisted-by: LLM OpenAI Codex
> 
> ---
>  fs/xfs/xfs_buf_item.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 1a4ef34af8d..80f0cf12825 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -80,7 +80,8 @@ xfs_buf_item_relse(
>  	trace_xfs_buf_item_relse(bp, _RET_IP_);
>  
>  	ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags));
> -	ASSERT(atomic_read(&bip->bli_refcount) == 0);
> +	if (atomic_read(&bip->bli_refcount))
> +		return;
>  
>  	bp->b_log_item = NULL;
>  	xfs_buf_rele(bp);
> 
> Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>

You didn't bother to check the mailing list or syzbot for
duplicates or prior discussion, did you?

What I said about this less than two days ago:

https://lore.kernel.org/linux-xfs/atUsQVuCKnAIZc3X@dread/

-Dave.
-- 
Dave Chinner
dgc@kernel.org

      reply	other threads:[~2026-10-20 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 20:04 Eduard Zateev
2026-10-20 20:55 ` Dave Chinner [this message]

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=atfVWiDCE2LSOBMU@dread \
    --to=dgc@kernel.org \
    --cc=cem@kernel.org \
    --cc=hackerowskiy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=syzbot+9d8e687768d0f38c1f09@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

all inboxes | Powered by JetHome®