Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Su Yue <suy.fnst@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: check namelen before read/memcmp_extent_buffer
Date: Mon, 29 May 2017 17:43:29 +0200	[thread overview]
Message-ID: <20170529154329.GO14523@twin.jikos.cz> (raw)
In-Reply-To: <20170525020908.25830-3-suy.fnst@cn.fujitsu.com>

This patch adds the name length verification to many places and in some
of them it looks unnecessary, as the directory item passes sanity checks
already. The verification should always happen when we read the input,
ie from disk, after search_slot etc. Then, it can be considered valid
and does not need the strict checks.

I haven't gone through all, one example is __add_inode_ref. The caller
add_inode_ref uses namelen before it reaches __add_inode_ref (and thus
the sanity checks).

As the checks add error hanlind branch, the entire callgraph of the
function should be verified, so I suggest to split the patch and group
only hunks that touch the same codepaths.

  reply	other threads:[~2017-05-29 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25  2:09 [PATCH 1/3] btrfs: Introduce btrfs_check_namelen to avoid reading beyond boundary Su Yue
2017-05-25  2:09 ` [PATCH 2/3] btrfs: check namelen with boundary in verify dir_item Su Yue
2017-05-29 15:24   ` David Sterba
2017-05-25  2:09 ` [PATCH 3/3] btrfs: check namelen before read/memcmp_extent_buffer Su Yue
2017-05-29 15:43   ` David Sterba [this message]
2017-05-31  2:31     ` Su Yue
2017-05-29 15:22 ` [PATCH 1/3] btrfs: Introduce btrfs_check_namelen to avoid reading beyond boundary David Sterba
2017-05-29 15:33   ` David Sterba

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=20170529154329.GO14523@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=suy.fnst@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