Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-afs@lists.infradead.org
Cc: Zhihao Cheng <chengzhihao1@huawei.com>,
	dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] afs: Fix memory leak in afs_put_sysnames()
Date: Tue, 09 Jun 2020 17:13:12 +0100	[thread overview]
Message-ID: <159171919260.3038039.5675242420072463110.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <159171918506.3038039.10915051218779105094.stgit@warthog.procyon.org.uk>

From: Zhihao Cheng <chengzhihao1@huawei.com>

Fix afs_put_sysnames() to actually free the specified afs_sysnames
object after its reference count has been decreased to zero and
its contents have been released.

Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/proc.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 22d00cf1913d..e817fc740ba0 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -567,6 +567,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames)
 			if (sysnames->subs[i] != afs_init_sysname &&
 			    sysnames->subs[i] != sysnames->blank)
 				kfree(sysnames->subs[i]);
+		kfree(sysnames);
 	}
 }
 



  reply	other threads:[~2020-06-09 16:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 16:13 [PATCH 0/6] afs: Fixes David Howells
2020-06-09 16:13 ` David Howells [this message]
2020-06-09 16:13 ` [PATCH 2/6] afs: Fix file locking David Howells
2020-06-09 16:13 ` [PATCH 3/6] afs: Fix use of BUG() David Howells
2020-06-09 16:19   ` Kees Cook
2020-06-09 16:13 ` [PATCH 4/6] afs: Fix debugging statements with %px to be %p David Howells
2020-06-09 16:18   ` Kees Cook
2020-06-09 17:08   ` Marc Dionne
2020-06-09 16:13 ` [PATCH 5/6] afs: Remove afs_zero_fid as it's not used David Howells
2020-06-09 16:13 ` [PATCH 6/6] afs: Make afs_zap_data() static David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159171919260.3038039.5675242420072463110.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 1/6] afs: Fix memory leak in afs_put_sysnames()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).