mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 00:29:36 -04:00
Btrfs: do not overwrite error return value in the balance ioctl
If the call to btrfs_balance() failed we would overwrite the error returned to user space with -EFAULT if the call to copy_to_user() failed as well. Fix that by calling copy_to_user() only if btrfs_balance() returned success or was canceled. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
d3a53286c1
commit
d00c2d9c76
@@ -4781,7 +4781,7 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
|
||||
ret = btrfs_balance(fs_info, bctl, bargs);
|
||||
bctl = NULL;
|
||||
|
||||
if (arg) {
|
||||
if ((ret == 0 || ret == -ECANCELED) && arg) {
|
||||
if (copy_to_user(arg, bargs, sizeof(*bargs)))
|
||||
ret = -EFAULT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user