[PATCH] v9fs: Twalk memory leak

From: Latchesar Ionkov
Date: Sat May 06 2006 - 15:24:09 EST


v9fs leaks memory if the file server responds with Rerror to a Twalk
message. The patch fixes the leak.

Signed-off-by: Latchesar Ionkov <lucho@xxxxxxxxxx>

---
commit d0ea523deb849227892c3359227219a260390dec
tree da70110e3a0691dd0a30d037b6456b9372c20f51
parent ebf34c9b6fcd22338ef764b039b3ac55ed0e297b
author Latchesar Ionkov <lucho@xxxxxxxxxx> Tue, 02 May 2006 16:42:24 -0600
committer Latchesar Ionkov <lucho@xxxxxxxxxx> Tue, 02 May 2006 16:42:24 -0600

fs/9p/fcall.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
index 71742ba..6f26178 100644
--- a/fs/9p/fcall.c
+++ b/fs/9p/fcall.c
@@ -98,23 +98,20 @@ v9fs_t_attach(struct v9fs_session_info *
static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
struct v9fs_fcall *rc, int err)
{
- int fid;
+ int fid, id;
struct v9fs_session_info *v9ses;

- if (err)
- return;
-
+ id = 0;
fid = tc->params.tclunk.fid;
- kfree(tc);
-
- if (!rc)
- return;
-
- v9ses = a;
- if (rc->id == RCLUNK)
- v9fs_put_idpool(fid, &v9ses->fidpool);
+ if (rc)
+ id = rc->id;

+ kfree(tc);
kfree(rc);
+ if (id == RCLUNK) {
+ v9ses = a;
+ v9fs_put_idpool(fid, &v9ses->fidpool);
+ }
}

/**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/