aboutsummaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorWouter van Kesteren <woutershep@gmail.com>2016-02-16 16:20:59 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-02-20 00:15:50 -0500
commit2feb55f89096b22e2de066e411a3263647211987 (patch)
tree44b6c6e9b75c40dace87ea10956ad2b692449fe5 /fs/read_write.c
parent18558cae0272f8fd9647e69d3fec1565a7949865 (diff)
fs: allow no_seek_end_llseek to actually seek
The user-visible impact of the issue is for example that without this patch sensors-detect breaks when trying to seek in /dev/cpu/0/cpuid. '~0ULL' is a 'unsigned long long' that when converted to a loff_t, which is signed, gets turned into -1. later in vfs_setpos we have 'if (offset > maxsize)', which makes it always return EINVAL. Fixes: b25472f9b961 ("new helpers: no_seek_end_llseek{,_size}()") Signed-off-by: Wouter van Kesteren <woutershep@gmail.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 324ec271cc4e..0c8782aa3d71 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -17,6 +17,7 @@
17#include <linux/splice.h> 17#include <linux/splice.h>
18#include <linux/compat.h> 18#include <linux/compat.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/fs.h>
20#include "internal.h" 21#include "internal.h"
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
@@ -183,7 +184,7 @@ loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
183 switch (whence) { 184 switch (whence) {
184 case SEEK_SET: case SEEK_CUR: 185 case SEEK_SET: case SEEK_CUR:
185 return generic_file_llseek_size(file, offset, whence, 186 return generic_file_llseek_size(file, offset, whence,
186 ~0ULL, 0); 187 OFFSET_MAX, 0);
187 default: 188 default:
188 return -EINVAL; 189 return -EINVAL;
189 } 190 }