]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
client: don't use uninitialized keyid in fscrypt_dummy_encryption 69880/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 08:58:17 +0000 (01:58 -0700)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 15 Jul 2026 13:28:52 +0000 (21:28 +0800)
commitd440950eff1302585cc03034b75eb62f841a4d92
tree2c572b9f1bfc570e8f6ac88f017c9de167382c24
parent5985acca8319c309290c580945cade7351a4c00d
client: don't use uninitialized keyid in fscrypt_dummy_encryption

When add_fscrypt_key() failed it jumped to the err label, which then
read the uninitialized keyid buffer into a key specifier and issued a
key removal for it. add_fscrypt_key() only populates keyid on success,
so this read uninitialized stack memory. Return the error directly
instead, since no key was added and there is nothing to remove.

Also stop overwriting the original error with remove_fscrypt_key()'s
return value on the policy-set failure path, so the real failure is
reported to the caller.

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