lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1380447470-2811-1-git-send-email-namhyung@kernel.org>
Date:	Sun, 29 Sep 2013 18:37:49 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Alexander Viro <viro@...iv.linux.org.uk>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] vfs: Get rid of duplicate offset checks in p{read,write}*

Current pread/pwrite functions simply checks whether offset is
negative.  Thus we couldn't use these functions for the large
(negative) offsets although some files did allow that.

Checking it correctly requires a file pointer and we already did
the check in rw_verify_area() so just remove the checks.

Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 fs/read_write.c |   16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index e3cd280b158c..878f40e50451 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -534,9 +534,6 @@ SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
 	struct fd f;
 	ssize_t ret = -EBADF;
 
-	if (pos < 0)
-		return -EINVAL;
-
 	f = fdget(fd);
 	if (f.file) {
 		ret = -ESPIPE;
@@ -554,9 +551,6 @@ SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
 	struct fd f;
 	ssize_t ret = -EBADF;
 
-	if (pos < 0)
-		return -EINVAL;
-
 	f = fdget(fd);
 	if (f.file) {
 		ret = -ESPIPE;
@@ -852,9 +846,6 @@ SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
 	struct fd f;
 	ssize_t ret = -EBADF;
 
-	if (pos < 0)
-		return -EINVAL;
-
 	f = fdget(fd);
 	if (f.file) {
 		ret = -ESPIPE;
@@ -876,9 +867,6 @@ SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
 	struct fd f;
 	ssize_t ret = -EBADF;
 
-	if (pos < 0)
-		return -EINVAL;
-
 	f = fdget(fd);
 	if (f.file) {
 		ret = -ESPIPE;
@@ -1002,8 +990,6 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
 	struct fd f;
 	ssize_t ret;
 
-	if (pos < 0)
-		return -EINVAL;
 	f = fdget(fd);
 	if (!f.file)
 		return -EBADF;
@@ -1069,8 +1055,6 @@ COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
 	struct fd f;
 	ssize_t ret;
 
-	if (pos < 0)
-		return -EINVAL;
 	f = fdget(fd);
 	if (!f.file)
 		return -EBADF;
-- 
1.7.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ