From: David Sterba <dave@jikos.cz>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: fix array bound checking
Date: Thu, 22 Sep 2011 12:20:03 +0200 [thread overview]
Message-ID: <20110922102003.GR22205@twin.jikos.cz> (raw)
In-Reply-To: <4E65E006.8030707@cn.fujitsu.com>
On Tue, Sep 06, 2011 at 04:55:34PM +0800, Li Zefan wrote:
> Otherwise we can execced the array bound of path->slots[].
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
> ---
> fs/btrfs/ctree.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 011cab3..0fe615e 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -902,9 +902,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
>
> orig_ptr = btrfs_node_blockptr(mid, orig_slot);
>
> - if (level < BTRFS_MAX_LEVEL - 1)
> + if (level < BTRFS_MAX_LEVEL - 1) {
> parent = path->nodes[level + 1];
> - pslot = path->slots[level + 1];
> + pslot = path->slots[level + 1];
> + }
>
> /*
> * deal with the case where there is only one pointer in the root
> @@ -1107,9 +1108,10 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
> mid = path->nodes[level];
> WARN_ON(btrfs_header_generation(mid) != trans->transid);
>
> - if (level < BTRFS_MAX_LEVEL - 1)
> + if (level < BTRFS_MAX_LEVEL - 1) {
> parent = path->nodes[level + 1];
> - pslot = path->slots[level + 1];
> + pslot = path->slots[level + 1];
> + }
>
> if (!parent)
> return 1;
> --
> 1.7.3.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2011-09-22 10:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 8:55 [PATCH] Btrfs: fix array bound checking Li Zefan
2011-09-22 10:20 ` David Sterba [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=20110922102003.GR22205@twin.jikos.cz \
--to=dave@jikos.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=lizf@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).