All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] afs: memory leak in afs_init_fs_context()
@ 2018-06-22 11:16 Dan Carpenter
  2018-06-22 12:36 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-06-22 11:16 UTC (permalink / raw)
  To: kernel-janitors

We need to free "ctx" before returning on this error path.

Fixes: 1ec2b51af007 ("afs: Add fs_context support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/afs/super.c b/fs/afs/super.c
index 656f810c5234..037f20f5ee90 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);

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

* Re: [PATCH] afs: memory leak in afs_init_fs_context()
  2018-06-22 11:16 [PATCH] afs: memory leak in afs_init_fs_context() Dan Carpenter
@ 2018-06-22 12:36 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2018-06-22 12:36 UTC (permalink / raw)
  To: kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We need to free "ctx" before returning on this error path.

I already have a patch for this that I've folded in, thanks.

David

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

end of thread, other threads:[~2018-06-22 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 11:16 [PATCH] afs: memory leak in afs_init_fs_context() Dan Carpenter
2018-06-22 12:36 ` David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.