From: "Darrick J. Wong" <djwong@kernel.org>
To: zhangyue <zhangyue1@kylinos.cn>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: fix the problem that the array may be out of bound
Date: Tue, 11 Jan 2022 11:32:12 -0800 [thread overview]
Message-ID: <20220111193212.GF656707@magnolia> (raw)
In-Reply-To: <20211119081758.399167-1-zhangyue1@kylinos.cn>
On Fri, Nov 19, 2021 at 04:17:58PM +0800, zhangyue wrote:
> In function 'xfs_btree_delrec()', if all data in array
> 'cur->bc_ptrs[level]' is 0, the 'level' may be greater than
> or equal to 'XFS_BTREE_MAXLEVELS'.
>
> At this time, the array may be out of bound.
>
> Signed-off-by: zhangyue <zhangyue1@kylinos.cn>
I /think/ this is no longer necessary since XFS_BTREE_MAXLEVELS went
away in 5.16, but if you disagree, please resend.
--D
> ---
> fs/xfs/libxfs/xfs_btree.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index bbdae2b4559f..fe66d1adc169 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -3694,6 +3694,9 @@ xfs_btree_delrec(
> tcur = NULL;
>
> /* Get the index of the entry being deleted, check for nothing there. */
> + if (level >= XFS_BTREE_MAXLEVELS)
> + return -EFSCORRUPTED;
> +
> ptr = cur->bc_ptrs[level];
> if (ptr == 0) {
> *stat = 0;
> --
> 2.30.0
>
prev parent reply other threads:[~2022-01-11 19:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 8:17 [PATCH] xfs: fix the problem that the array may be out of bound zhangyue
2022-01-11 19:32 ` Darrick J. Wong [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=20220111193212.GF656707@magnolia \
--to=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zhangyue1@kylinos.cn \
/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