From: Sun Yuechi Date: Wed, 1 Jul 2026 08:56:16 +0000 (-0700) Subject: client: fix _wrap_name reporting success on encryption failure X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5985acca8319c309290c580945cade7351a4c00d;p=ceph.git client: fix _wrap_name reporting success on encryption failure _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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 17366b83269..fcac11545e7 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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); }