summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/qgroup.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-07-12 08:42:19 +0200
committerDavid Sterba <dsterba@suse.com>2017-08-16 16:12:02 +0200
commitb6e6bca51e531989de11af7967bd32bd973d96b9 (patch)
tree38377b00826bf90a87839ac8e9e58df98dbfd847 /fs/btrfs/qgroup.c
parentbtrfs: Enhance message when a device is missing during mount (diff)
downloadlinux-b6e6bca51e531989de11af7967bd32bd973d96b9.tar.xz
linux-b6e6bca51e531989de11af7967bd32bd973d96b9.zip
btrfs: qgroups: Fix BUG_ON condition in tree level check
The current code was erroneously checking for root_level > BTRFS_MAX_LEVEL. If we had a root_level of 8 then the check won't trigger and we could potentially hit a buffer overflow. The correct check should be root_level >= BTRFS_MAX_LEVEL . Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r--fs/btrfs/qgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 4ce351efe281..acb48983be26 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1603,7 +1603,7 @@ int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans,
struct extent_buffer *eb = root_eb;
struct btrfs_path *path = NULL;
- BUG_ON(root_level < 0 || root_level > BTRFS_MAX_LEVEL);
+ BUG_ON(root_level < 0 || root_level >= BTRFS_MAX_LEVEL);
BUG_ON(root_eb == NULL);
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))