diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2008-10-23 17:33:25 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2008-11-05 14:19:06 -0500 |
commit | 45abdf1c7be80d6ec3b0b14e59ee75a0d5d9fb37 (patch) | |
tree | 34a5ea23b63df0da422ff161ec580f9b2ca54680 /net/9p/client.c | |
parent | 82b189eaaf6186b7694317632255fa87460820a0 (diff) |
p9: Fix leak of waitqueue in request allocation path
If a T or R fcall cannot be allocated, the function returns an error
but neglects to free the wait queue that was successfully allocated.
If it comes through again a second time this wq will be overwritten
with a new allocation and the old allocation will be leaked.
Also, if the client is subsequently closed, the close path will
attempt to clean up these allocations, so set the req fields to
NULL to avoid duplicate free.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r-- | net/9p/client.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 26ca8ab45196..b56d808e63a9 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -189,6 +189,9 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag) | |||
189 | printk(KERN_ERR "Couldn't grow tag array\n"); | 189 | printk(KERN_ERR "Couldn't grow tag array\n"); |
190 | kfree(req->tc); | 190 | kfree(req->tc); |
191 | kfree(req->rc); | 191 | kfree(req->rc); |
192 | kfree(req->wq); | ||
193 | req->tc = req->rc = NULL; | ||
194 | req->wq = NULL; | ||
192 | return ERR_PTR(-ENOMEM); | 195 | return ERR_PTR(-ENOMEM); |
193 | } | 196 | } |
194 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); | 197 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); |