linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] afs: Fix afs_server struct leak
@ 2018-10-12 12:46 David Howells
  0 siblings, 0 replies; 3+ messages in thread
From: David Howells @ 2018-10-12 12:46 UTC (permalink / raw)
  To: gregkh, torvalds; +Cc: dhowells, linux-afs, linux-kernel

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 <dhowells@redhat.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;
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] afs: Fix afs_server struct leak
  2018-10-12 13:00 David Howells
@ 2018-10-12 15:37 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-10-12 15:37 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, linux-afs, linux-kernel, stable

On Fri, Oct 12, 2018 at 02:00:57PM +0100, David Howells wrote:
> 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@redhat.com>

Now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] afs: Fix afs_server struct leak
@ 2018-10-12 13:00 David Howells
  2018-10-12 15:37 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2018-10-12 13:00 UTC (permalink / raw)
  To: gregkh, torvalds; +Cc: dhowells, linux-afs, linux-kernel, stable

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@redhat.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;
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-12 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12 12:46 [PATCH] afs: Fix afs_server struct leak David Howells
2018-10-12 13:00 David Howells
2018-10-12 15:37 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).