aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSanchit Garg <sancgarg@linux.vnet.ibm.com>2010-10-27 00:11:01 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2010-10-28 10:08:49 -0400
commitf6ac55b6c156cebf750376dc08e06ffdade82717 (patch)
treefd173ac547ec84f90b56cf6d8a90f737b4b2748f /net
parentb165d60145b717261a0234f989c442c2b68b6ec0 (diff)
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> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c5
1 files changed, 1 insertions, 4 deletions
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,
1286 1286
1287 if (data) { 1287 if (data) {
1288 memmove(data, dataptr, count); 1288 memmove(data, dataptr, count);
1289 } 1289 } else {
1290
1291 if (udata) {
1292 err = copy_to_user(udata, dataptr, count); 1290 err = copy_to_user(udata, dataptr, count);
1293 if (err) { 1291 if (err) {
1294 err = -EFAULT; 1292 err = -EFAULT;
1295 goto free_and_error; 1293 goto free_and_error;
1296 } 1294 }
1297 } 1295 }
1298
1299 p9_free_req(clnt, req); 1296 p9_free_req(clnt, req);
1300 return count; 1297 return count;
1301 1298