dax_io(): don't let non-error value escape via retval instead of EFAULT
authorAl Viro <viro@ZenIV.linux.org.uk>
Wed, 11 Nov 2015 02:42:49 +0000 (19:42 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 11 Nov 2015 16:36:57 +0000 (09:36 -0700)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Cc: stable@vger.kernel.org # 4.0+
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/dax.c

index a86d3cc2b38941b0e39f23be84e4986d8852ae42..7b653e9aa8d1cee30e2b157cc407f947675bda64 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -169,8 +169,10 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
                else
                        len = iov_iter_zero(max - pos, iter);
 
-               if (!len)
+               if (!len) {
+                       retval = -EFAULT;
                        break;
+               }
 
                pos += len;
                addr += len;