From: "Luís Henriques" <lhenriques@suse.de>
To: Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Jeff Layton <jlayton@kernel.org>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
"Luís Henriques" <lhenriques@suse.de>
Subject: [PATCH v2] ceph: fix memory leak in mount error path when using test_dummy_encryption
Date: Tue, 8 Nov 2022 14:34:21 +0000 [thread overview]
Message-ID: <20221108143421.30993-1-lhenriques@suse.de> (raw)
Because ceph_init_fs_context() will never be invoced in case we get a
mount error, destroy_mount_options() won't be releasing fscrypt resources
with fscrypt_free_dummy_policy(). This will result in a memory leak. Add
an invocation to this function in the mount error path.
Signed-off-by: Luís Henriques <lhenriques@suse.de>
---
* Changes since v1:
As suggested by Xiubo, moved fscrypt free from ceph_get_tree() to
ceph_real_mount().
(Also used 'git format-patch' with '--base' so that the bots know what to
(not) do with this patch.)
fs/ceph/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 2224d44d21c0..f10a076f47e5 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1196,6 +1196,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
out:
mutex_unlock(&fsc->client->mount_mutex);
+ ceph_fscrypt_free_dummy_policy(fsc);
return ERR_PTR(err);
}
base-commit: 8b9ee21dfceadd4cc35a87bbe7f0ad547cffa1be
prerequisite-patch-id: 34ba9e6b37b68668d261ddbda7858ee6f83c82fa
prerequisite-patch-id: 87f1b323c29ab8d0a6d012d30fdc39bc49179624
prerequisite-patch-id: c94f448ef026375b10748457a3aa46070aa7046e
next reply other threads:[~2022-11-08 14:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 14:34 Luís Henriques [this message]
2022-11-09 3:08 ` Xiubo Li
2022-11-09 9:33 ` Luís Henriques
2022-11-09 9:40 ` Xiubo Li
2022-11-09 9:57 ` Xiubo Li
2022-11-09 10:38 ` Luís Henriques
2022-11-09 14:01 ` Xiubo Li
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=20221108143421.30993-1-lhenriques@suse.de \
--to=lhenriques@suse.de \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiubli@redhat.com \
/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
all inboxes | Powered by JetHome®