Skip to content

Commit f014ffb

Browse files
dhowellsgregkh
authored andcommitted
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: d2ddc77 ("afs: Overhaul volume and server record caching and fileserver rotation") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b40afc0 commit f014ffb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/afs/server.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ static struct afs_server *afs_install_server(struct afs_net *net,
199199

200200
write_sequnlock(&net->fs_addr_lock);
201201
ret = 0;
202+
goto out;
202203

203204
exists:
204205
afs_get_server(server);
206+
out:
205207
write_sequnlock(&net->fs_lock);
206208
return server;
207209
}

0 commit comments

Comments
 (0)