btrfs-progs: Fix null pointer deref in balance_level
PATCH 1/1 btrfs-progs: Fix null pointer deref in balance_level
In case the right buffer is emptied it's first set to null and subsequently it's dereferenced to get its size to pass to root_sub_used. This naturally leads to a null pointer dereference. The correct thing to do is to pass the stashed right->len in "blocksize".
Fixes #296
--- kernel-shared/ctree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel-shared/ctree.c +1 -1
@@ -927,7 +927,7 @@ static int balance_level(struct btrfs_trans_handle *trans,if (wret) ret = wret; -root_sub_used (root, right->len); +root_sub_used (root, blocksize); wret = btrfs_free_extent(trans, root, bytenr, blocksize, 0, root->root_key.objectid,
Signature · 1 line
2.25.1
Quoted 8 lines · Nikolay Borisov
In case the right buffer is emptied it's first set to null and subsequently it's dereferenced to get its size to pass to
root_sub_used. This naturally leads to a null pointer dereference. The correct thing to do is to pass the stashedright->lenin "blocksize".Fixes #296
Signed-off-by Nikolay Borisov <[email protected]>
Thanks,
Josef
Quoted 6 lines · Nikolay Borisov
In case the right buffer is emptied it's first set to null and subsequently it's dereferenced to get its size to pass to
root_sub_used. This naturally leads to a null pointer dereference. The correct thing to do is to pass the stashedright->lenin "blocksize".Fixes #296
I'm using the "Issue: #123" format for that.
Quoted 1 line
Signed-off-by Nikolay Borisov <[email protected]>
Added to devel, thanks.