]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
btrfs: return EINVAL if start > total_bytes in fitrim ioctl
authorLukas Czerner <lczerner@redhat.com>
Mon, 5 Sep 2011 14:34:54 +0000 (16:34 +0200)
committerDavid Sterba <dsterba@suse.cz>
Thu, 20 Oct 2011 16:10:40 +0000 (18:10 +0200)
commitf4c697e6406da5dd445eda8d923c53e1138793dd
treea572fcd0b9db22177d74c8fd3276ccb6a05c028c
parent008873eafbc77deb1702aedece33756c58486c6a
btrfs: return EINVAL if start > total_bytes in fitrim ioctl

We should retirn EINVAL if the start is beyond the end of the file
system in the btrfs_ioctl_fitrim(). Fix that by adding the appropriate
check for it.

Also in the btrfs_trim_fs() it is possible that len+start might overflow
if big values are passed. Fix it by decrementing the len so that start+len
is equal to the file system size in the worst case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
fs/btrfs/ioctl.c