]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix CEPH_CAP_FILE_WR caps reference leakage in _write() 50107/head
authorXiubo Li <xiubli@redhat.com>
Tue, 14 Feb 2023 11:35:14 +0000 (19:35 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 14 Feb 2023 12:50:33 +0000 (20:50 +0800)
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>
src/client/Client.cc

index a7211d5af7ed87afcffc6c4e18e9712d7dda8769..52cd288b805cff1dcd47b87603b5208f1a3f56b1 100644 (file)
@@ -10720,8 +10720,10 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf,
 
     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);
   }