Commit f6ac55b6 authored by Sanchit Garg's avatar Sanchit Garg Committed by Eric Van Hensbergen

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: default avatarSanchit Garg <sancgarg@linux.vnet.ibm.com>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent b165d601
...@@ -1286,16 +1286,13 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, ...@@ -1286,16 +1286,13 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
if (data) { if (data) {
memmove(data, dataptr, count); memmove(data, dataptr, count);
} } else {
if (udata) {
err = copy_to_user(udata, dataptr, count); err = copy_to_user(udata, dataptr, count);
if (err) { if (err) {
err = -EFAULT; err = -EFAULT;
goto free_and_error; goto free_and_error;
} }
} }
p9_free_req(clnt, req); p9_free_req(clnt, req);
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment