libceph: define and enforce CEPH_MAX_KEY_LEN

[ Upstream commit ac431d597a ]

When decoding the key, verify that the key material would fit into
a fixed-size buffer in process_auth_done() and generally has a sane
length.

The new CEPH_MAX_KEY_LEN check replaces the existing check for a key
with no key material which is a) not universal since CEPH_CRYPTO_NONE
has to be excluded and b) doesn't provide much value since a smaller
than needed key is just as invalid as no key -- this has to be handled
elsewhere anyway.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Ilya Dryomov 2025-07-04 16:30:50 +02:00 • committed by Sasha Levin
commit 1b275bd49e
3 changed files with 7 additions and 5 deletions