From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: Brad Boyer <flar@allandria.com>
Cc: v9fs-developer@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Sanchit Garg <sancgarg@linux.vnet.ibm.com>
Subject: Re: [PATCH 2/2] net/9p: Return error on read with NULL buffer
Date: Sun, 24 Oct 2010 20:02:32 +0530 [thread overview]
Message-ID: <m31v7f1x1b.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20101023195957.GA13348@cynthia.pants.nu>
On Sat, 23 Oct 2010 12:59:57 -0700, Brad Boyer <flar@allandria.com> wrote:
> On Mon, Oct 18, 2010 at 08:10:53PM +0530, Aneesh Kumar K.V wrote:
> > This patch ensures that a read(fd, NULL, 0 ) returns EFAULT on a 9p file.
>
> Is there some specific reason you want this behavior? I believe the
> generic Linux code returns success in this case. I tried this exact
> system call with fd being a pty or a file on ext3 and got 0 for both.
Linux code return 0 in case count == 0;
This is what i find on ext4.
open("a.c", O_RDONLY) = 3
read(3, 0, 10) = -1 EFAULT (Bad address)
open("a.c", O_RDONLY) = 3
read(3, NULL, 0) = 0
This patch ensure that we get the behaviour as in case one in case of 9p
file system. But patch broke the behaviour in step 2. So below is the
updated one
commit bd1717e5300ab0bb9aa2df139ffbc5e49f1baeb6
Author: Sanchit Garg <sancgarg@linux.vnet.ibm.com>
Date: Tue Oct 19 09:17:02 2010 +0530
net/9p: Return error on read with NULL buffer
This patch ensures that a read(fd, NULL, 10) returns EFAULT on a 9p file.
Signed-off-by: Sanchit Garg <sancgarg@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
diff --git a/net/9p/client.c b/net/9p/client.c
index e141e46..dbca5b3 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1333,16 +1333,13 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
if (data) {
memmove(data, dataptr, count);
- }
-
- if (udata) {
+ } else {
err = copy_to_user(udata, dataptr, count);
if (err) {
err = -EFAULT;
goto free_and_error;
}
}
-
p9_free_req(clnt, req);
return count;
-aneesh
prev parent reply other threads:[~2010-10-24 14:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-18 14:40 [PATCH 1/2] net/9p: Return error if we fail to encode protocol data Aneesh Kumar K.V
2010-10-18 14:40 ` [PATCH 2/2] net/9p: Return error on read with NULL buffer Aneesh Kumar K.V
2010-10-23 19:59 ` Brad Boyer
2010-10-24 14:32 ` Aneesh Kumar K. V [this message]
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=m31v7f1x1b.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=flar@allandria.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sancgarg@linux.vnet.ibm.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).