summaryrefslogtreecommitdiff
path: root/fs/btrfs/struct-funcs.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2016-08-23 17:37:45 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-16 22:16:07 +0100
commit1ef3ecf373ae2c650894fbfc4de385dde4fd76cb (patch)
tree4c0714cdd5aa13083743b0d757fe36d9e1461cb2 /fs/btrfs/struct-funcs.c
parentdc059e58af01c31a8d593cc99086cf41600852b2 (diff)
Btrfs: check btree node's nritems
commit 053ab70f0604224c7893b43f9d9d5efa283580d6 upstream. When btree node (level = 1) has nritems which equals to zero, we can end up with panic due to insert_ptr()'s BUG_ON(slot > nritems); where slot is 1 and nritems is 0, as copy_for_split() calls insert_ptr(.., path->slots[1] + 1, ...); A invalid value results in the whole mess, this adds the check for btree's node nritems so that we stop reading block when when something is wrong. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Chris Mason <clm@fb.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/struct-funcs.c')
0 files changed, 0 insertions, 0 deletions