[PATCH v4 2/3] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE

Jarkko Sakkinen jarkko at kernel.org
Tue Oct 20 21:18:09 UTC 2026


On Wed, Oct 21, 2026 at 12:16:23AM +0300, Jarkko Sakkinen wrote:
> On Tue, Oct 20, 2026 at 08:43:20PM +0300, Jarkko Sakkinen wrote:
> 
> There is only case in key_alloc() where index_key.desc_len is not set:
> 
> 	desclen = strlen(desc);
> 	if (desclen >= KEY_MAX_DESC_SIZE)
> 		goto error;
> 
> 
> Other sites match to:
> 
> 	static int keyring_index_key_set_desc(void *desc, int desclen)
 	static inline int keyring_index_key_set_desc(struct keyring_index_key *index_key, void *desc, int desclen)
> 	{
> 		desclen = strlen(index_key.description);
> 		if (desclen >= KEY_MAX_DESC_SIZE) {
> 			return -EINVAL;
> 		}
> 		index_key->desc_len = desclen;

		return 0;
> 	}	


Br, Jarkko



More information about the Linux-security-module-archive mailing list