]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix _wrap_name reporting success on encryption failure
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 08:56:16 +0000 (01:56 -0700)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 15 Jul 2026 13:28:45 +0000 (21:28 +0800)
_wrap_name() returns bool, but two encryption error paths did "return r"
with r < 0, which converts to true. Callers then treated the failure as
success and used the unencrypted name. Return false instead.

Fixes: https://tracker.ceph.com/issues/78246
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/client/Client.cc

index 17366b83269994953a967711953afe8cae4bb84b..fcac11545e7d4134ba586e89dc5c8242f80e603e 100644 (file)
@@ -1417,7 +1417,7 @@ bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_
     int r = fscrypt_denc->get_encrypted_fname(dname, &_enc_name, &_alt_name, false);
     if (r < 0) {
       ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to encrypt filename" << dendl;
-      return r;
+      return false;
     }
     dname = std::move(_enc_name);
     if (alternate_name.empty()) {
@@ -1428,7 +1428,7 @@ bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_
       int r = fscrypt_denc->get_encrypted_fname(alternate_name, &_enc_name, &_alt_name, true);
       if (r < 0) {
         ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to encrypt filename" << dendl;
-        return r;
+        return false;
       }
       alternate_name = std::move(_alt_name);
     }