]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Fix bound checking in qgroup_trace_new_subtree_blocks
authorNikolay Borisov <nborisov@suse.com>
Mon, 18 Mar 2019 15:45:19 +0000 (17:45 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 19 Mar 2019 13:12:31 +0000 (14:12 +0100)
commitce94a43ba0ebec8a5f10bb0fd1db8cc602ec6cfd
tree97cec6b8466e56b77f6aadc84cbea18d64ee114b
parentd38dd536b1b75167b591650741f69eb7109769fa
btrfs: Fix bound checking in qgroup_trace_new_subtree_blocks

If 'cur_level' is 7  then the bound checking at the top of the function
will actually pass. Later on, it's possible to dereference
ds_path->nodes[cur_level+1] which will be an out of bounds.

The correct check will be cur_level >= BTRFS_MAX_LEVEL - 1 .

Fixes-coverty-id: 1440918
Fixes-coverty-id: 1440911
Fixes: 56211073e05c ("btrfs: qgroup: Introduce function to find all new tree blocks of reloc tree")
CC: stable@vger.kernel.org # 4.20+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/qgroup.c