linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] btrfs: check namelen before read name
@ 2017-06-01  8:57 Su Yue
  2017-06-01  8:57 ` [PATCH v2 1/9] btrfs: Introduce btrfs_is_namelen_valid to avoid reading beyond boundary Su Yue
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Su Yue @ 2017-06-01  8:57 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

When reading out name from inode_ref, dir_item, it's possible that
corrupted name_len leads to read beyond boundary.
Since there are already patches for btrfs-progs, this patchset is
for btrfs.

Introduce 'btrfs_is_namelen_valid' to make check namelen with
item boundary.
If read name from dir_item, use 'verify_dir_item' to do more strict
check. Otherwise, use 'btrfs_is_namelen_valid'.

It's unnessary to do check before every read/memcmp_extent_buffer name.
Checking namelen when read name for the first time in the call graph is
enough.

Changlog:
v2:
	1.Change 'btrfs_check_namelen' to 'btrfs_is_namelen_valid'.
	2.Split patches according call graph.

Su Yue (9):
  btrfs: Introduce btrfs_is_namelen_valid to avoid reading beyond
    boundary
  btrfs: Check namelen with boundary in verify dir_item
  btrfs: Check name len on add_inode_ref call path
  btrfs: Verify dir_item in 'replay_xattr_deletes'
  btrfs: Check namelen in 'btrfs_check_ref_name_override'
  btrfs: Check name before read in 'iterate_dir_item'
  btrfs: Check namelen before read in 'btrfs_get_name'
  btrfs: Check namelen before in 'btrfs_del_root_ref'
  btrfs: Verify dir_item 'in iterate_object_props'

 fs/btrfs/ctree.h     |  4 ++-
 fs/btrfs/dir-item.c  | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 fs/btrfs/export.c    |  5 +++
 fs/btrfs/inode.c     |  2 +-
 fs/btrfs/props.c     |  7 +++++
 fs/btrfs/root-tree.c |  7 +++++
 fs/btrfs/send.c      |  6 ++++
 fs/btrfs/tree-log.c  | 43 ++++++++++++++++++-------
 fs/btrfs/xattr.c     |  2 +-
 9 files changed, 149 insertions(+), 16 deletions(-)

-- 
2.13.0




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-06-05 15:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01  8:57 [PATCH v2 0/9] btrfs: check namelen before read name Su Yue
2017-06-01  8:57 ` [PATCH v2 1/9] btrfs: Introduce btrfs_is_namelen_valid to avoid reading beyond boundary Su Yue
2017-06-01  9:44   ` Nikolay Borisov
2017-06-02  3:55     ` Su Yue
2017-06-01  8:57 ` [PATCH v2 2/9] btrfs: Check namelen with boundary in verify dir_item Su Yue
2017-06-01  8:57 ` [PATCH v2 3/9] btrfs: Check name len on add_inode_ref call path Su Yue
2017-06-01  9:53   ` Nikolay Borisov
2017-06-01 17:18     ` David Sterba
2017-06-01  8:57 ` [PATCH v2 4/9] btrfs: Verify dir_item in 'replay_xattr_deletes' Su Yue
2017-06-01  8:57 ` [PATCH v2 5/9] btrfs: Check namelen in 'btrfs_check_ref_name_override' Su Yue
2017-06-01  8:57 ` [PATCH v2 6/9] btrfs: Check name before read in 'iterate_dir_item' Su Yue
2017-06-01  9:58   ` Nikolay Borisov
2017-06-02 17:07     ` David Sterba
2017-06-01  8:57 ` [PATCH v2 7/9] btrfs: Check namelen before read in 'btrfs_get_name' Su Yue
2017-06-01  8:57 ` [PATCH v2 8/9] btrfs: Check namelen before in 'btrfs_del_root_ref' Su Yue
2017-06-05 15:12   ` David Sterba
2017-06-01  8:57 ` [PATCH v2 9/9] btrfs: Verify dir_item 'in iterate_object_props' Su Yue
2017-06-02 17:34 ` [PATCH v2 0/9] btrfs: check namelen before read name David Sterba
2017-06-02 18:01   ` David Sterba

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).