Skip to content

Commit 2342630

Browse files
MaxKellermannidryomov
authored andcommitted
ceph: pass cred pointer to ceph_mds_auth_match()
This eliminates a redundant get_current_cred() call, because ceph_mds_check_access() has already obtained this pointer. As a side effect, this also fixes a reference leak in ceph_mds_auth_match(): by omitting the get_current_cred() call, no additional cred reference is taken. Cc: stable@vger.kernel.org Fixes: 596afb0 ("ceph: add ceph_mds_check_access() helper") Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 8ea412e commit 2342630

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ceph/mds_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5601,9 +5601,9 @@ void send_flush_mdlog(struct ceph_mds_session *s)
56015601

56025602
static int ceph_mds_auth_match(struct ceph_mds_client *mdsc,
56035603
struct ceph_mds_cap_auth *auth,
5604+
const struct cred *cred,
56045605
char *tpath)
56055606
{
5606-
const struct cred *cred = get_current_cred();
56075607
u32 caller_uid = from_kuid(&init_user_ns, cred->fsuid);
56085608
u32 caller_gid = from_kgid(&init_user_ns, cred->fsgid);
56095609
struct ceph_client *cl = mdsc->fsc->client;
@@ -5726,7 +5726,7 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
57265726
for (i = 0; i < mdsc->s_cap_auths_num; i++) {
57275727
struct ceph_mds_cap_auth *s = &mdsc->s_cap_auths[i];
57285728

5729-
err = ceph_mds_auth_match(mdsc, s, tpath);
5729+
err = ceph_mds_auth_match(mdsc, s, cred, tpath);
57305730
if (err < 0) {
57315731
return err;
57325732
} else if (err > 0) {

0 commit comments

Comments
 (0)