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@xxxxxxxxx> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html