[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <153934925704.24054.3222195700321846862.stgit@warthog.procyon.org.uk>
Date: Fri, 12 Oct 2018 14:00:57 +0100
From: David Howells <dhowells@...hat.com>
To: gregkh@...uxfoundation.org, torvalds@...ux-foundation.org
Cc: dhowells@...hat.com, linux-afs@...ts.infradead.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: [PATCH] afs: Fix afs_server struct leak
Fix a leak of afs_server structs. The routine that installs them in the
various lookup lists and trees gets a ref on leaving the function, whether
it added the server or a server already exists. It shouldn't increment
the refcount if it added the server.
The effect of this that "rmmod kafs" will hang waiting for the leaked
server to become unused.
Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/afs/server.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 1d329e6981d5..2f306c0cc4ee 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -199,9 +199,11 @@ static struct afs_server *afs_install_server(struct afs_net *net,
write_sequnlock(&net->fs_addr_lock);
ret = 0;
+ goto out;
exists:
afs_get_server(server);
+out:
write_sequnlock(&net->fs_lock);
return server;
}
Powered by blists - more mailing lists