]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: qgroup: Fix possible leak in btrfs_add_qgroup_relation()
authorChristian Engelmayer <cengelma@gmx.at>
Sat, 2 May 2015 15:19:55 +0000 (17:19 +0200)
committerChris Mason <clm@fb.com>
Wed, 3 Jun 2015 02:34:35 +0000 (19:34 -0700)
commit9fd2f501a4adaf38465003996e29415e6d28903e
tree4f84ca683181984c54a2073b521470db0faf9311
parent1b5daa0e1b553f1c93e0987d746480fb4751d521
btrfs: qgroup: Fix possible leak in btrfs_add_qgroup_relation()

Commit 19ce1c2f84bf ("btrfs: quota: Automatically update related qgroups or
mark INCONSISTENT flags when assigning/deleting a qgroup relations.")
introduced the allocation of a temporary ulist in function
btrfs_add_qgroup_relation() and added the corresponding cleanup to the out
path. However, the allocation was introduced before the src/dst level check
that directly returns. Fix the possible leakage of the ulist by moving the
allocation after the input validation. Detected by Coverity CID 1295988.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/qgroup.c