All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Jens Axboe <axboe@kernel.dk>
Cc: xiaosuo@gmail.com, tim.gardner@canonical.com,
	torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] splice: check f_mode for seekable file
Date: Tue, 29 Jun 2010 13:10:36 +0200	[thread overview]
Message-ID: <E1OTYi4-0008IE-Aq@pomaz-ex.szeredi.hu> (raw)
In-Reply-To: <E1OTYfk-0008GY-PJ@pomaz-ex.szeredi.hu> (message from Miklos Szeredi on Tue, 29 Jun 2010 13:08:12 +0200)

From: Changli Gao <xiaosuo@gmail.com>

check f_mode for seekable file

As a seekable file is allowed without a llseek function, so the old way isn't
work any more.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
----
 fs/splice.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6/fs/splice.c
===================================================================
--- linux-2.6.orig/fs/splice.c	2010-06-29 12:46:28.000000000 +0200
+++ linux-2.6/fs/splice.c	2010-06-29 12:46:30.000000000 +0200
@@ -1372,8 +1372,7 @@ static long do_splice(struct file *in, l
 		if (off_in)
 			return -ESPIPE;
 		if (off_out) {
-			if (!out->f_op || !out->f_op->llseek ||
-			    out->f_op->llseek == no_llseek)
+			if (!(out->f_mode & FMODE_PWRITE))
 				return -EINVAL;
 			if (copy_from_user(&offset, off_out, sizeof(loff_t)))
 				return -EFAULT;
@@ -1393,8 +1392,7 @@ static long do_splice(struct file *in, l
 		if (off_out)
 			return -ESPIPE;
 		if (off_in) {
-			if (!in->f_op || !in->f_op->llseek ||
-			    in->f_op->llseek == no_llseek)
+			if (!(in->f_mode & FMODE_PREAD))
 				return -EINVAL;
 			if (copy_from_user(&offset, off_in, sizeof(loff_t)))
 				return -EFAULT;

  parent reply	other threads:[~2010-06-29 11:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 11:08 [PATCH 0/3] splice fixes Miklos Szeredi
2010-06-29 11:09 ` [PATCH 1/3] splice: direct_splice_actor() should not use pos in sd Miklos Szeredi
2010-06-29 11:10 ` Miklos Szeredi [this message]
2010-06-29 11:13 ` [PATCH 3/3] splice: fix misuse of SPLICE_F_NONBLOCK Miklos Szeredi
2010-06-29 11:15 ` [PATCH 0/3] splice fixes Jens Axboe
2010-06-29 12:05   ` Miklos Szeredi
2010-06-29 12:05     ` Jens Axboe
2010-07-07 20:38       ` Andrew Morton
2010-07-08 13:36         ` Jens Axboe
2010-07-08 13:38           ` Jens Axboe
2010-07-08 17:25             ` Andrew Morton
2010-07-08 17:30               ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1OTYi4-0008IE-Aq@pomaz-ex.szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.gardner@canonical.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xiaosuo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.