Re: [PATCH] KEYS: fix overflow in keyctl_pkey_params_get_2()

Jarkko Sakkinen <[email protected]> Sun, 31 May 2026 20:04:50 +0300
Newsgroups org.kernel.vger.keyrings,org.kernel.vger.linux-kernel,org.kernel.vger.linux-security-module,org.kernel.vger.stable
Message-ID <[email protected]>
On Sun, May 31, 2026 at 09:23:11AM +0200, Alessandro G wrote:
> Hi Jarkko,
> 
> The surname is “Groppo” instead of “Grupp”, don’t worry and thanks for asking!
> 
> Thanks also for the fix!
> 
> BR,
> Alessandro

Thank you! This was a super good bug report.

Since I cannot do it without permission, can I add your tested-by to the
patch?

BR, Jarkko

> 
> Il giorno dom 31 mag 2026 alle 05:25 Jarkko Sakkinen <[email protected]> ha
> scritto:
> 
>     On Sun, May 31, 2026 at 05:49:13AM +0300, Jarkko Sakkinen wrote:
>     > The length for the internal output buffer is calculated incorrectly,
>     which
>     > can result overflow when a too small buffer is provided.
>     >
>     > Fix the bug by allocating internal output with the size of the maximum
>     > length of the cryptographic primitive instead of caller provided size.
>     >
>     > Cc: [email protected] # v4.20+
>     > Fixes: 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops
>     for asymmetric keys [ver #2]")
>     > Reported-by: Alessandro Grupp <[email protected]>
>     > Signed-off-by: Jarkko Sakkinen <[email protected]>
> 
>     Should be available in -next within a day or along the lines so please
>     be quick with tags/feedback. I'll forward a PR as soon as all is good.
> 
>     BR, Jarkko
>