All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs@vger.kernel.org, cem@kernel.org, hch@lst.de
Subject: Re: [PATCH 1/2] xfs: add missing cursor status check after xfs_get_rec
Date: Tue, 13 Oct 2026 14:58:23 -0700	[thread overview]
Message-ID: <20261013215823.GF2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <20261013211851.641256-2-sandeen@redhat.com>

On Tue, Oct 13, 2026 at 04:07:46PM -0500, Eric Sandeen wrote:
> The xfs_inobt_get_rec() call in xfs_ialloc_count_ondisk fails to check
> the &has_record return - if the record is not found, the next
> conditional will read an uninitialized  or stale irec. Fix that.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Yeah, we had better check has_record before using irec...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_ialloc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index e705f681ed44..17699f7c009f 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2843,6 +2843,11 @@ xfs_ialloc_count_ondisk(
>  		error = xfs_inobt_get_rec(cur, &irec, &has_record);
>  		if (error)
>  			return error;
> +		if (XFS_IS_CORRUPT(cur->bc_mp, has_record != 1)) {
> +			xfs_btree_mark_sick(cur);
> +			return -EFSCORRUPTED;
> +		}
> +
>  		if (irec.ir_startino > high)
>  			break;
>  
> -- 
> 2.55.0
> 
> 

  reply	other threads:[~2026-10-13 21:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 21:07 [PATCH 0/2] xfs: add missing cursor status check after btree ops Eric Sandeen
2026-10-13 21:07 ` [PATCH 1/2] xfs: add missing cursor status check after xfs_get_rec Eric Sandeen
2026-10-13 21:58   ` Darrick J. Wong [this message]
2026-10-14  0:16   ` [PATCH 1/2 V2] xfs: add missing cursor status check after xfs_inobt_get_rec Eric Sandeen
2026-10-14 13:20     ` Christoph Hellwig
2026-10-13 21:07 ` [PATCH 2/2] xfs: add missing cursor stat checks after xfs_btree_delete Eric Sandeen
2026-10-13 21:59   ` Darrick J. Wong
2026-10-14 13:21   ` Christoph Hellwig
2026-10-14  8:28 ` [PATCH 0/2] xfs: add missing cursor status check after btree ops Carlos Maiolino

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=20261013215823.GF2705364@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.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.