Skip to content

Commit c5cf420

Browse files
MaxKellermannidryomov
authored andcommitted
ceph: fix cred leak in ceph_mds_check_access()
get_current_cred() increments the reference counter, but the put_cred() call was missing. 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 2342630 commit c5cf420

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ceph/mds_client.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5728,6 +5728,7 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
57285728

57295729
err = ceph_mds_auth_match(mdsc, s, cred, tpath);
57305730
if (err < 0) {
5731+
put_cred(cred);
57315732
return err;
57325733
} else if (err > 0) {
57335734
/* always follow the last auth caps' permission */
@@ -5743,6 +5744,8 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
57435744
}
57445745
}
57455746

5747+
put_cred(cred);
5748+
57465749
doutc(cl, "root_squash_perms %d, rw_perms_s %p\n", root_squash_perms,
57475750
rw_perms_s);
57485751
if (root_squash_perms && rw_perms_s == NULL) {

0 commit comments

Comments
 (0)