diff options
| author | Tony Hutter <hutter2@llnl.gov> | 2026-04-23 17:52:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-23 17:52:19 +0000 |
| commit | fc6aa4369ef79bde105a359019575d9103541287 (patch) | |
| tree | f9082b1bfcb8c271a592eab0028844842b309862 | |
| parent | 67589348e3c1587ddca1167072084e910334869f (diff) | |
| -rw-r--r-- | module/os/linux/zfs/zfs_uio.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c index 8f9b161995f4..bfce9e6b5202 100644 --- a/module/os/linux/zfs/zfs_uio.c +++ b/module/os/linux/zfs/zfs_uio.c @@ -234,6 +234,8 @@ zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, boolean_t revert) { size_t cnt = MIN(n, uio->uio_resid); + size_t oldcnt = cnt; + int error = 0; if (rw == UIO_READ) cnt = copy_to_iter(p, cnt, uio->uio_iter); @@ -249,16 +251,21 @@ zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, return (EFAULT); /* - * Revert advancing the uio_iter. This is set by zfs_uiocopy() - * to avoid consuming the uio and its iov_iter structure. + * When revert is set this is a zfs_uiocopy() which should not + * consume the uio and its iov_iter structure. Otherwise, it's + * a zfs_uiomove() which is expected to update the uio. Partial + * copies are allowed for both copy and move but EFAULT should + * be returned for zfs_uiomove(). */ if (revert) iov_iter_revert(uio->uio_iter, cnt); + else if (cnt != oldcnt) + error = EFAULT; uio->uio_resid -= cnt; uio->uio_loffset += cnt; - return (0); + return (error); } int |
