Inter-revision diff: patch 2

Comparing v5 (message) to v6 (message)

--- v5
+++ v6
@@ -4,15 +4,15 @@
 Signed-off-by: Milosz Tanski <milosz@adfin.com>
 Reviewed-by: Christoph Hellwig <hch@lst.de>
 ---
- fs/read_write.c                   | 176 ++++++++++++++++++++++++++++++--------
+ fs/read_write.c                   | 172 ++++++++++++++++++++++++++++++--------
  include/linux/compat.h            |   6 ++
  include/linux/syscalls.h          |   6 ++
  include/uapi/asm-generic/unistd.h |   6 +-
  mm/filemap.c                      |   5 +-
- 5 files changed, 158 insertions(+), 41 deletions(-)
+ 5 files changed, 156 insertions(+), 39 deletions(-)
 
 diff --git a/fs/read_write.c b/fs/read_write.c
-index 94b2d34..907735c 100644
+index 94b2d34..b1b4bc8 100644
 --- a/fs/read_write.c
 +++ b/fs/read_write.c
 @@ -866,6 +866,8 @@ ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
@@ -197,16 +197,19 @@
  {
  	ssize_t ret = -EBADF;
  
-@@ -1052,7 +1106,7 @@ static size_t compat_readv(struct file *file,
+@@ -1051,8 +1105,10 @@ static size_t compat_readv(struct file *file,
+ 	ret = -EINVAL;
  	if (!(file->f_mode & FMODE_CAN_READ))
  		goto out;
++	if (flags & ~0)
++		goto out;
  
 -	ret = compat_do_readv_writev(READ, file, vec, vlen, pos);
 +	ret = compat_do_readv_writev(READ, file, vec, vlen, pos, flags);
  
  out:
  	if (ret > 0)
-@@ -1061,9 +1115,9 @@ out:
+@@ -1061,9 +1117,9 @@ out:
  	return ret;
  }
  
@@ -219,7 +222,7 @@
  {
  	struct fd f = fdget_pos(fd);
  	ssize_t ret;
-@@ -1072,28 +1126,34 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd,
+@@ -1072,16 +1128,24 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd,
  	if (!f.file)
  		return -EBADF;
  	pos = f.file->f_pos;
@@ -246,11 +249,7 @@
  {
  	struct fd f;
  	ssize_t ret;
- 
--	if (pos < 0)
--		return -EINVAL;
- 	f = fdget(fd);
- 	if (!f.file)
+@@ -1093,7 +1157,7 @@ static long __compat_sys_preadv64(unsigned long fd,
  		return -EBADF;
  	ret = -ESPIPE;
  	if (f.file->f_mode & FMODE_PREAD)
@@ -259,26 +258,20 @@
  	fdput(f);
  	return ret;
  }
-@@ -1103,7 +1163,10 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
+@@ -1103,7 +1167,7 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
  		const struct compat_iovec __user *,vec,
  		unsigned long, vlen, loff_t, pos)
  {
 -	return __compat_sys_preadv64(fd, vec, vlen, pos);
-+	if (pos < 0)
-+		return -EINVAL;
-+
 +	return __compat_sys_preadv64(fd, vec, vlen, pos, 0);
  }
  #endif
  
-@@ -1113,12 +1176,28 @@ COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
+@@ -1113,12 +1177,25 @@ COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
  {
  	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
  
 -	return __compat_sys_preadv64(fd, vec, vlen, pos);
-+	if (pos < 0)
-+		return -EINVAL;
-+
 +	return __compat_sys_preadv64(fd, vec, vlen, pos, 0);
 +}
 +
@@ -302,9 +295,12 @@
  {
  	ssize_t ret = -EBADF;
  
-@@ -1129,7 +1208,7 @@ static size_t compat_writev(struct file *file,
+@@ -1128,8 +1205,10 @@ static size_t compat_writev(struct file *file,
+ 	ret = -EINVAL;
  	if (!(file->f_mode & FMODE_CAN_WRITE))
  		goto out;
++	if (flags & ~0)
++		goto out;
  
 -	ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos);
 +	ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags);
@@ -379,7 +375,7 @@
  
 -	return __compat_sys_pwritev64(fd, vec, vlen, pos);
 +	return __compat_sys_pwritev64(fd, vec, vlen, pos, 0);
- }
++}
 +
 +COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
 +		const struct compat_iovec __user *,vec,
@@ -391,7 +387,7 @@
 +		return __compat_sys_writev(fd, vec, vlen, flags);
 +
 +	return __compat_sys_pwritev64(fd, vec, vlen, pos, flags);
-+}
+ }
 +
  #endif
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help