afs: Fix afs_server struct leak
diff mbox series

Message ID
State New
Headers show
  • afs: Fix afs_server struct leak
Related show

Commit Message

David Howells Oct. 12, 2018, 12:46 p.m. UTC
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.

Signed-off-by: David Howells <>

 fs/afs/server.c |    2 ++
 1 file changed, 2 insertions(+)

diff mbox series

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,
 	ret = 0;
+	goto out;
 	return server;