mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] splice: Get rid of duplicate f_mode checks
@ 2013-09-29  6:14 Namhyung Kim
  2013-09-29  6:14 ` [PATCH 2/5] splice: Add sync parameter to wakeup_pipe_readers() Namhyung Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Namhyung Kim @ 2013-09-29  6:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel, Jens Axboe

The do_splice() function was only called from sys_splice() but it
already checks the f_mode both for in and out.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 fs/splice.c |    9 ---------
 1 file changed, 9 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 3b7ee656f3aa..320cc65585b2 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1333,12 +1333,6 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 		if (off_in || off_out)
 			return -ESPIPE;
 
-		if (!(in->f_mode & FMODE_READ))
-			return -EBADF;
-
-		if (!(out->f_mode & FMODE_WRITE))
-			return -EBADF;
-
 		/* Splicing to self would be fun, but... */
 		if (ipipe == opipe)
 			return -EINVAL;
@@ -1358,9 +1352,6 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 			offset = out->f_pos;
 		}
 
-		if (unlikely(!(out->f_mode & FMODE_WRITE)))
-			return -EBADF;
-
 		if (unlikely(out->f_flags & O_APPEND))
 			return -EINVAL;
 
-- 
1.7.9.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-29  6:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-29  6:14 [PATCH 1/5] splice: Get rid of duplicate f_mode checks Namhyung Kim
2013-09-29  6:14 ` [PATCH 2/5] splice: Add sync parameter to wakeup_pipe_readers() Namhyung Kim
2013-09-29  6:14 ` [PATCH 3/5] splice: Add sync parameter to wakeup_pipe_writers() Namhyung Kim
2013-09-29  6:14 ` [PATCH 4/5] splice: Use sync wakeup for splice_from_pipe_next() Namhyung Kim
2013-09-29  6:14 ` [PATCH 5/5] pipe: Do not use sync wakeups Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®