]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: fix possible leak in btrfs_ioctl_balance()
authorChristian Engelmayer <cengelma@gmx.at>
Tue, 20 Oct 2015 22:50:06 +0000 (00:50 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:28:28 +0000 (19:28 -0800)
commit787135d01f9b455726d28963fc08669dda5d032f
tree0de05a2780425dc36ad18923c8c9d92a7f42c776
parente09c380cc98073a8e77276f22ae796edea67e1b6
btrfs: fix possible leak in btrfs_ioctl_balance()

Orabug: 22623825

commit 0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e upstream.

Commit 8eb934591f8b ("btrfs: check unsupported filters in balance
arguments") adds a jump to exit label out_bargs in case the argument
check fails. At this point in addition to the bargs memory, the
memory for struct btrfs_balance_control has already been allocated.
Ownership of bctl is passed to btrfs_balance() in the good case,
thus the memory is not freed due to the introduced jump. Make sure
that the memory gets freed in any case as necessary. Detected by
Coverity CID 1328378.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ee03d02ebc5dd0ee414fc47eb3992e8d3aa7396e)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
fs/btrfs/ioctl.c