提交 b9b8a41a 编写于 作者: D Dan Carpenter 提交者: David Sterba

btrfs: use after free in btrfs_quota_enable

The issue here is that btrfs_commit_transaction() frees "trans" on both
the error and the success path.  So the problem would be if
btrfs_commit_transaction() succeeds, and then qgroup_rescan_init()
fails.  That means that "ret" is non-zero and "trans" is non-NULL and it
leads to a use after free inside the btrfs_end_transaction() macro.

Fixes: 340f1aa2 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 801660b0
......@@ -1019,10 +1019,9 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info)
spin_unlock(&fs_info->qgroup_lock);
ret = btrfs_commit_transaction(trans);
if (ret) {
trans = NULL;
trans = NULL;
if (ret)
goto out_free_path;
}
ret = qgroup_rescan_init(fs_info, 0, 1);
if (!ret) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册