From: Xiubo Li <xiubli@redhat.com>
To: Max Kellermann <max.kellermann@ionos.com>,
idryomov@gmail.com, ceph-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 2/2] fs/ceph/mds_client: fix cred leak in ceph_mds_check_access()
Date: Mon, 25 Nov 2024 08:53:05 +0800 [thread overview]
Message-ID: <b52a83ea-6e74-4bf4-b634-8d77e369e873@redhat.com> (raw)
In-Reply-To: <20241123072121.1897163-2-max.kellermann@ionos.com>
On 11/23/24 15:21, Max Kellermann wrote:
> get_current_cred() increments the reference counter, but the
> put_cred() call was missing.
>
> Fixes: 596afb0b8933 ("ceph: add ceph_mds_check_access() helper")
> Cc: stable@vger.kernel.org
> Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
> ---
> fs/ceph/mds_client.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e8a5994de8b6..35d83c8c2874 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -5742,6 +5742,7 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
>
> err = ceph_mds_auth_match(mdsc, s, cred, tpath);
> if (err < 0) {
> + put_cred(cred);
> return err;
> } else if (err > 0) {
> /* always follow the last auth caps' permision */
> @@ -5757,6 +5758,8 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
> }
> }
>
> + put_cred(cred);
> +
> doutc(cl, "root_squash_perms %d, rw_perms_s %p\n", root_squash_perms,
> rw_perms_s);
> if (root_squash_perms && rw_perms_s == NULL) {
Good catch.
Reviewed-by: Xiubo Li <xiubli@redhat.com>
next prev parent reply other threads:[~2024-11-25 0:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-23 7:21 [PATCH 1/2] fs/ceph/mds_client: pass cred pointer to ceph_mds_auth_match() Max Kellermann
2024-11-23 7:21 ` [PATCH 2/2] fs/ceph/mds_client: fix cred leak in ceph_mds_check_access() Max Kellermann
2024-11-25 0:53 ` Xiubo Li [this message]
2024-11-25 14:55 ` Ilya Dryomov
2024-11-25 0:52 ` [PATCH 1/2] fs/ceph/mds_client: pass cred pointer to ceph_mds_auth_match() Xiubo Li
2024-11-25 14:54 ` Ilya Dryomov
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=b52a83ea-6e74-4bf4-b634-8d77e369e873@redhat.com \
--to=xiubli@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=max.kellermann@ionos.com \
--cc=stable@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
all inboxes | Powered by JetHome®