diff options
| author | David Sterba <dsterba@suse.com> | 2026-01-06 17:20:28 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-04-07 18:56:07 +0200 |
| commit | 463626a2eccffc8945c73bc9361367ae4d8779a7 (patch) | |
| tree | 6940c99b924aab8cda185be44e55640a89adecfc | |
| parent | b8aa337121ddfb050199ecda57b0654d5e3d91e9 (diff) | |
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>
| -rw-r--r-- | fs/btrfs/extent_io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 211a0aa03afb..9d7ca80477fd 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4061,8 +4061,8 @@ int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb, unsigned long i; int ret = 0; - WARN_ON(start > eb->len); - WARN_ON(start + len > eb->start + eb->len); + if (check_eb_range(eb, start, len)) + return -EINVAL; if (eb->addr) { if (copy_to_user_nofault(dstv, eb->addr + start, len)) |
