From f6ac55b6c156cebf750376dc08e06ffdade82717 Mon Sep 17 00:00:00 2001 From: Sanchit Garg Date: Wed, 27 Oct 2010 09:41:01 +0530 Subject: 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 Signed-off-by: Aneesh Kumar K.V Signed-off-by: Eric Van Hensbergen --- net/9p/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'net/9p') diff --git a/net/9p/client.c b/net/9p/client.c index 8df80fb86f23..a848bca9fbff 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -1286,16 +1286,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; -- cgit v1.2.3-58-ga151