This is a note to let you know that I've just added the patch titled iomap: Fix iomap_dio_rw return value for user copies to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iomap-fix-iomap_dio_rw-return-value-for-user-copies.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Fri Apr 29 11:07:48 AM CEST 2022 From: Anand Jain <anand.jain@xxxxxxxxxx> Date: Fri, 15 Apr 2022 06:28:48 +0800 Subject: iomap: Fix iomap_dio_rw return value for user copies To: stable@xxxxxxxxxxxxxxx Cc: linux-btrfs@xxxxxxxxxxxxxxx, Andreas Gruenbacher <agruenba@xxxxxxxxxx>, "Darrick J . Wong" <djwong@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Anand Jain <anand.jain@xxxxxxxxxx> Message-ID: <63440885619fdfa1a520a9528e38207311f44f2a.1649951733.git.anand.jain@xxxxxxxxxx> From: Andreas Gruenbacher <agruenba@xxxxxxxxxx> commit 42c498c18a94eed79896c50871889af52fa0822e upstream 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@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/iomap/direct-io.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -371,6 +371,8 @@ static loff_t iomap_dio_hole_iter(const 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(cons copied = copy_to_iter(inline_data, length, iter); } dio->size += copied; + if (!copied) + return -EFAULT; return copied; } Patches currently in stable-queue which might be from anand.jain@xxxxxxxxxx are queue-5.15/gup-turn-fault_in_pages_-readable-writeable-into-fault_in_-readable-writeable.patch queue-5.15/iov_iter-introduce-nofault-flag-to-disable-page-faults.patch queue-5.15/gfs2-fix-mmap-page-fault-deadlocks-for-direct-i-o.patch queue-5.15/iomap-support-partial-direct-i-o-on-user-copy-failures.patch queue-5.15/mm-gup-make-fault_in_safe_writeable-use-fixup_user_fault.patch queue-5.15/gfs2-add-wrapper-for-iomap_file_buffered_write.patch queue-5.15/gup-introduce-foll_nofault-flag-to-disable-page-faults.patch queue-5.15/iov_iter-introduce-fault_in_iov_iter_writeable.patch queue-5.15/gfs2-fix-mmap-page-fault-deadlocks-for-buffered-i-o.patch queue-5.15/btrfs-fallback-to-blocking-mode-when-doing-async-dio-over-multiple-extents.patch queue-5.15/gfs2-clean-up-function-may_grant.patch queue-5.15/btrfs-fix-deadlock-due-to-page-faults-during-direct-io-reads-and-writes.patch queue-5.15/iov_iter-turn-iov_iter_fault_in_readable-into-fault_in_iov_iter_readable.patch queue-5.15/gfs2-move-the-inode-glock-locking-to-gfs2_file_buffered_write.patch queue-5.15/gfs2-introduce-flag-for-glock-holder-auto-demotion.patch queue-5.15/iomap-fix-iomap_dio_rw-return-value-for-user-copies.patch queue-5.15/gfs2-eliminate-ip-i_gh.patch queue-5.15/iomap-add-done_before-argument-to-iomap_dio_rw.patch