Skip to content

Commit

Permalink
afs: Fix afs_server struct leak
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dhowells authored and gregkh committed Oct 12, 2018
1 parent b40afc0 commit f014ffb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/afs/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f014ffb

Please sign in to comment.