9p: Possible regression in p9_client_stat
authorAbhishek Kulkarni <adkulkar@umail.iu.edu>
Tue, 14 Jul 2009 18:25:41 +0000 (13:25 -0500)
committerEric Van Hensbergen <ericvh@vTrogdor.(none)>
Tue, 14 Jul 2009 20:54:41 +0000 (15:54 -0500)
Fix a possible regression with p9_client_stat where it can try to kfree
an ERR_PTR after an erroneous p9pdu_readf. Also remove an unnecessary data
buffer increment in p9_client_read.

Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
net/9p/client.c

index 783a4107740381e1f033843b74ce61401a65a4e3..787ccddb85ea6cd8c53550deef5a11e3336a4ee1 100644 (file)
@@ -1098,7 +1098,6 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
 
        if (data) {
                memmove(data, dataptr, count);
-               data += count;
        }
 
        if (udata) {
@@ -1192,9 +1191,9 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
 
        err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret);
        if (err) {
-               ret = ERR_PTR(err);
                p9pdu_dump(1, req->rc);
-               goto free_and_error;
+               p9_free_req(clnt, req);
+               goto error;
        }
 
        P9_DPRINTK(P9_DEBUG_9P,
@@ -1211,8 +1210,6 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
        p9_free_req(clnt, req);
        return ret;
 
-free_and_error:
-       p9_free_req(clnt, req);
 error:
        kfree(ret);
        return ERR_PTR(err);