From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/4] xfs: fix buffer state when we reject a corrupt dir free block
Date: Tue, 3 Mar 2020 12:19:08 -0800 [thread overview]
Message-ID: <20200303201908.GF8045@magnolia> (raw)
In-Reply-To: <158294092192.1729975.12710230360219661807.stgit@magnolia>
On Fri, Feb 28, 2020 at 05:48:41PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Fix two problems in the dir3 free block read routine when we want to
> reject a corrupt free block. First, buffers should never have DONE set
> at the same time that b_error is EFSCORRUPTED. Second, don't leak a
> pointer back to the caller.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_dir2_node.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>
> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> index a0cc5e240306..f622ede7119e 100644
> --- a/fs/xfs/libxfs/xfs_dir2_node.c
> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> @@ -227,7 +227,9 @@ __xfs_dir3_free_read(
> fa = xfs_dir3_free_header_check(dp, fbno, *bpp);
> if (fa) {
> xfs_verifier_error(*bpp, -EFSCORRUPTED, fa);
Now that I've had time to think about this further, I conclude that this
call ought to be xfs_buf_corruption_error() since we created that
function to handle exactly this sort of thing...
> + (*bpp)->b_flags &= ~XBF_DONE;
...and then we don't need this piece.
> xfs_trans_brelse(tp, *bpp);
> + *bpp = NULL;
But we still need this because xfs_trans_brelse could have nuked *bpp
and we should never pass a (potentially stale and now reused) pointer up
to a caller, even if we are about to return an error code.
--D
> return -EFSCORRUPTED;
> }
>
>
next prev parent reply other threads:[~2020-03-03 20:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-29 1:48 [PATCH 0/4] xfs: fix errors in directory verifiers Darrick J. Wong
2020-02-29 1:48 ` [PATCH 1/4] xfs: fix buffer state when we reject a corrupt dir free block Darrick J. Wong
2020-03-02 18:11 ` Allison Collins
2020-03-02 23:54 ` Eric Sandeen
2020-03-03 16:38 ` Darrick J. Wong
2020-03-03 17:43 ` Darrick J. Wong
2020-03-03 23:45 ` Dave Chinner
2020-03-05 17:45 ` Darrick J. Wong
2020-03-03 20:19 ` Darrick J. Wong [this message]
2020-03-05 16:49 ` Christoph Hellwig
2020-02-29 1:48 ` [PATCH 2/4] xfs: check owner of dir3 free blocks Darrick J. Wong
2020-03-02 18:11 ` Allison Collins
2020-03-03 0:04 ` Eric Sandeen
2020-03-03 16:08 ` Darrick J. Wong
2020-03-03 16:10 ` Eric Sandeen
2020-03-05 16:50 ` Christoph Hellwig
2020-02-29 1:48 ` [PATCH 3/4] xfs: check owner of dir3 data blocks Darrick J. Wong
2020-03-02 18:12 ` Allison Collins
2020-03-03 16:43 ` Darrick J. Wong
2020-03-05 16:50 ` Christoph Hellwig
2020-02-29 1:49 ` [PATCH 4/4] xfs: check owner of dir3 blocks Darrick J. Wong
2020-03-02 18:12 ` Allison Collins
2020-03-05 16:51 ` Christoph Hellwig
2020-03-05 17:48 ` Darrick J. Wong
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=20200303201908.GF8045@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.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