From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] afs/super.c: Fix memory leak in afs_init_fs_context
Date: Wed, 20 Jun 2018 08:19:12 -0500 [thread overview]
Message-ID: <20180620131912.GA31745@embeddedor.com> (raw)
Release resources allocated for *ctx* before return.
Addresses-Coverity-ID: 1470101 ("Resource leak")
Fixes: 1ec2b51af007 ("afs: Add fs_context support")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
fs/afs/super.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 656f810..037f20f 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -596,8 +596,10 @@ static int afs_init_fs_context(struct fs_context *fc, struct dentry *reference)
break;
case FS_CONTEXT_FOR_SUBMOUNT:
- if (!reference)
+ if (!reference) {
+ kfree(ctx);
return -EINVAL;
+ }
src_as = AFS_FS_S(reference->d_sb);
ASSERT(src_as);
--
2.7.4
next reply other threads:[~2018-06-20 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 13:19 Gustavo A. R. Silva [this message]
2018-06-22 11:21 ` 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=20180620131912.GA31745@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome