aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-10-18 23:47:02 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2010-10-28 10:08:49 -0400
commit7b3bb3fe166702b504f1068359c9550d3b277eaf (patch)
tree8a3c8039f55126dbafb23a06d7b03a1e5abf3d24 /net
parent877cb3d4dd73838adcc6b79f2a3d29b155e7ebbe (diff)
net/9p: Return error if we fail to encode protocol data
We need to return error in case we fail to encode data in protocol buffer. This patch also return error in case of a failed copy_from_user. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c2
-rw-r--r--net/9p/protocol.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index bc7b03537699..e3cfdff37327 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -579,6 +579,8 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
579 va_start(ap, fmt); 579 va_start(ap, fmt);
580 err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap); 580 err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap);
581 va_end(ap); 581 va_end(ap);
582 if (err)
583 goto reterr;
582 p9pdu_finalize(req->tc); 584 p9pdu_finalize(req->tc);
583 585
584 err = c->trans_mod->request(c, req); 586 err = c->trans_mod->request(c, req);
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 3acd3afb20c8..45c15f491401 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -122,9 +122,8 @@ static size_t
122pdu_write_u(struct p9_fcall *pdu, const char __user *udata, size_t size) 122pdu_write_u(struct p9_fcall *pdu, const char __user *udata, size_t size)
123{ 123{
124 size_t len = MIN(pdu->capacity - pdu->size, size); 124 size_t len = MIN(pdu->capacity - pdu->size, size);
125 int err = copy_from_user(&pdu->sdata[pdu->size], udata, len); 125 if (copy_from_user(&pdu->sdata[pdu->size], udata, len))
126 if (err) 126 len = 0;
127 printk(KERN_WARNING "pdu_write_u returning: %d\n", err);
128 127
129 pdu->size += len; 128 pdu->size += len;
130 return size - len; 129 return size - len;