diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2021-07-15 22:31:02 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2021-10-24 15:26:05 +0200 |
commit | 42c498c18a94eed79896c50871889af52fa0822e (patch) | |
tree | a7e1776997955259906c4dbd94eb19a597dfa21d | |
parent | 00bfe02f479688a67a29019d1228f1470e26f014 (diff) | |
download | linux-stable-42c498c18a94eed79896c50871889af52fa0822e.tar.gz linux-stable-42c498c18a94eed79896c50871889af52fa0822e.tar.bz2 linux-stable-42c498c18a94eed79896c50871889af52fa0822e.zip |
iomap: Fix iomap_dio_rw return value for user copies
When a user copy fails in one of the helpers of iomap_dio_rw, fail with
-EFAULT instead of returning 0. This matches what iomap_dio_bio_actor
returns when it gets an -EFAULT from bio_iov_iter_get_pages. With these
changes, iomap_dio_actor now consistently fails with -EFAULT when a user
page cannot be faulted in.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | fs/iomap/direct-io.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 4ecd255e0511..a2a368e824c0 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -371,6 +371,8 @@ static loff_t iomap_dio_hole_iter(const struct iomap_iter *iter, loff_t length = iov_iter_zero(iomap_length(iter), dio->submit.iter); dio->size += length; + if (!length) + return -EFAULT; return length; } @@ -402,6 +404,8 @@ static loff_t iomap_dio_inline_iter(const struct iomap_iter *iomi, copied = copy_to_iter(inline_data, length, iter); } dio->size += copied; + if (!copied) + return -EFAULT; return copied; } |