linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: David Sterba <dsterba@suse.cz>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH][RFC] btrfs: fix potential overflow in leafsize accounting
Date: Fri, 17 Jun 2011 15:18:43 -0400	[thread overview]
Message-ID: <1308338282-sup-4067@shiny> (raw)
In-Reply-To: <1307986264-5707-1-git-send-email-dsterba@suse.cz>

Excerpts from David Sterba's message of 2011-06-13 13:31:04 -0400:
> smatch reported a dead code. It seems to allow wrong item size counting
> in leaves, as the first for loop does not adjust the maximum number for
> items that would fit in BTRFS_LEAF_DATA_SIZE, and the rest of the code
> works with the wrong value. The value of 'nr' is accompanied with
> accumulating total_data and total_size, which are compared to the leaf
> size and probably prevent this bug to do more harm, but the errorneously
> computed value of 'nr' is later used in moving existing items and lastly
> for setting up the item for new data.
> 
> The bug has a potential to silently corrupt data when leaves are near to
> full, though I'm not aware of any related reports so far.

btrfs_insert_some_items is actually dead code.  I've just deleted it
instead, but you're completely right that this is a bug.

-chris

      reply	other threads:[~2011-06-17 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 17:31 [PATCH][RFC] btrfs: fix potential overflow in leafsize accounting David Sterba
2011-06-17 19:18 ` Chris Mason [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=1308338282-sup-4067@shiny \
    --to=chris.mason@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).