Re: [PATCH] crypto: Fix logical operator in _aead_recvmsg()
From: Herbert Xu
Date: Mon Sep 16 2024 - 04:40:56 EST
On Mon, Sep 16, 2024 at 10:44:22AM +0300, George Rurikov wrote:
> From: MrRurikov <grurikovsherbakov@xxxxxxxxx>
>
> After having been compared to a NULL value at algif_aead.c:191, pointer
> 'tsgl_src' is passed as 2nd parameter in call to function
> 'crypto_aead_copy_sgl' at algif_aead.c:244, where it is dereferenced at
> algif_aead.c:85.
>
> Change logical operator from && to || because pointer 'tsgl_src' is NULL,
> then 'proccessed' will still be non-null
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 2d97591ef43d ("crypto: af_alg - consolidation of duplicate code")
> Signed-off-by: MrRurikov <grurikovsherbakov@xxxxxxxxx>
> ---
> crypto/algif_aead.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Cc Stephan.
>
> diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
> index 7d58cbbce4af..135f09a4b3f8 100644
> --- a/crypto/algif_aead.c
> +++ b/crypto/algif_aead.c
> @@ -191,7 +191,7 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
> if (tsgl_src)
> break;
> }
> - if (processed && !tsgl_src) {
> + if (processed || !tsgl_src) {
> err = -EFAULT;
> goto free;
> }
> --
> 2.34.1
>
> Заявление о конфиденциальности
>
> Данное электронное письмо и любые приложения к нему являются конфиденциальными и предназначены исключительно для адресата. Если Вы не являетесь адресатом данного письма, пожалуйста, уведомите немедленно отправителя, не раскрывайте содержание другим лицам, не используйте его в каких-либо целях, не храните и не копируйте информацию любым способом.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt