net/9p: fix statsize inside twstat

Previous thread: net/9p: fix virtio transport to correctly update status on connect by Linux Kernel Mailing List on Tuesday, February 9, 2010 - 6:59 pm. (1 message)

Next thread: 9p: Fix the kernel crash on a failed mount by Linux Kernel Mailing List on Tuesday, February 9, 2010 - 6:59 pm. (1 message)
From: Linux Kernel Mailing List
Date: Tuesday, February 9, 2010 - 6:59 pm

Gitweb:     http://git.kernel.org/linus/9d6939dac77102b09396ee0b89392ec7639612a7
Commit:     9d6939dac77102b09396ee0b89392ec7639612a7
Parent:     349d3bb878d71978650a0634b5445af3c1cc1cd8
Author:     Eric Van Hensbergen <ericvh@gmail.com>
AuthorDate: Fri Jan 15 19:01:56 2010 -0600
Committer:  Eric Van Hensbergen <ericvh@gmail.com>
CommitDate: Mon Feb 8 14:13:30 2010 -0600

    net/9p: fix statsize inside twstat
    
    stat structures contain a size prefix.  In our twstat messages
    we were including the size of the size prefix in the prefix, which is not
    what the protocol wants, and Inferno servers would complain.
    
    Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
---
 net/9p/client.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 90a2eb9..a2e2d61 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1222,10 +1222,11 @@ static int p9_client_statsize(struct p9_wstat *wst, int optional)
 {
 	int ret;
 
+	/* NOTE: size shouldn't include its own length */
 	/* size[2] type[2] dev[4] qid[13] */
 	/* mode[4] atime[4] mtime[4] length[8]*/
 	/* name[s] uid[s] gid[s] muid[s] */
-	ret = 2+2+4+13+4+4+4+8+2+2+2+2;
+	ret = 2+4+13+4+4+4+8+2+2+2+2;
 
 	if (wst->name)
 		ret += strlen(wst->name);
@@ -1266,7 +1267,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
 		wst->name, wst->uid, wst->gid, wst->muid, wst->extension,
 		wst->n_uid, wst->n_gid, wst->n_muid);
 
-	req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size, wst);
+	req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size+2, wst);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
 		goto error;
--

Previous thread: net/9p: fix virtio transport to correctly update status on connect by Linux Kernel Mailing List on Tuesday, February 9, 2010 - 6:59 pm. (1 message)

Next thread: 9p: Fix the kernel crash on a failed mount by Linux Kernel Mailing List on Tuesday, February 9, 2010 - 6:59 pm. (1 message)