]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:40 +0000 (21:20 -0500)
commit7c13532fbc721848aba3767d96b18b65366e6619
treed7cb666905de7034880045fe5395431b701691a5
parente223b090e2250090a5c227ca0ea876f0b8c5a5d2
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>
(cherry picked from commit f4c697e6406da5dd445eda8d923c53e1138793dd)
fs/btrfs/ioctl.c