Skip to content

Commit

Permalink
net/9p: Return error on read with NULL buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sanchit Garg authored and Eric Van Hensbergen committed Oct 28, 2010
1 parent b165d60 commit f6ac55b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f6ac55b

Please sign in to comment.