If the __setattrx() fails it will leave the CEPH_CAP_FILE_WR caps
reference kept.
Fixes: https://tracker.ceph.com/issues/58717
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit
93d69dd77f10b901cd0c7b713bf71acb365e5271)
put_cap_ref(in, CEPH_CAP_AUTH_SHARED);
r = __setattrx(in, &stx, CEPH_SETATTR_KILL_SGUID, f->actor_perms);
- if (r < 0)
+ if (r < 0) {
+ put_cap_ref(in, CEPH_CAP_FILE_WR);
return r;
+ }
} else {
put_cap_ref(in, CEPH_CAP_AUTH_SHARED);
}