Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: use common eb range validation in read_extent_buffer_to_user_nofault()

The extent buffer access is checked in other helpers by
check_eb_range(), which validates the requested start, length against
the extent buffer. While this almost never fails we should still handle
it as an error and not just warn.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>

+2 -2
+2 -2
fs/btrfs/extent_io.c
··· 4061 4061 unsigned long i; 4062 4062 int ret = 0; 4063 4063 4064 - WARN_ON(start > eb->len); 4065 - WARN_ON(start + len > eb->start + eb->len); 4064 + if (check_eb_range(eb, start, len)) 4065 + return -EINVAL; 4066 4066 4067 4067 if (eb->addr) { 4068 4068 if (copy_to_user_nofault(dstv, eb->addr + start, len))