]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: do not overwrite error return value in the device replace ioctl
authorFilipe Manana <fdmanana@suse.com>
Tue, 8 Jan 2019 11:42:09 +0000 (11:42 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Feb 2019 13:13:20 +0000 (14:13 +0100)
commit3e9ade090119f8027ce33a0442dd05c8da4d3a33
tree865efa0570bd819dca70fb7119b96fde2781ed41
parent2c5cbbcded028bfa68818edaa94751b305eac63d
Btrfs: do not overwrite error return value in the device replace ioctl

If the call to btrfs_dev_replace_by_ioctl() 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 no error
happened before or a device replace operation 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>
fs/btrfs/ioctl.c