linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: George Rurikov <g.ryurikov@securitycode.ru>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: MrRurikov <grurikovsherbakov@yandex.ru>,
	"David S . Miller" <davem@davemloft.net>,
	<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<lvc-project@linuxtesting.org>, <stable@vger.kernel.org>
Subject: [PATCH] crypto: Fix logical operator in _aead_recvmsg()
Date: Mon, 16 Sep 2024 10:44:22 +0300	[thread overview]
Message-ID: <20240916074422.503645-1-g.ryurikov@securitycode.ru> (raw)

From: MrRurikov <grurikovsherbakov@yandex.ru>

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@vger.kernel.org
Fixes: 2d97591ef43d ("crypto: af_alg - consolidation of duplicate code")
Signed-off-by: MrRurikov <grurikovsherbakov@yandex.ru>
---
 crypto/algif_aead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

Заявление о конфиденциальности

Данное электронное письмо и любые приложения к нему являются конфиденциальными и предназначены исключительно для адресата. Если Вы не являетесь адресатом данного письма, пожалуйста, уведомите немедленно отправителя, не раскрывайте содержание другим лицам, не используйте его в каких-либо целях, не храните и не копируйте информацию любым способом.

             reply	other threads:[~2024-09-16  8:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16  7:44 George Rurikov [this message]
2024-09-16  8:33 ` [PATCH] crypto: Fix logical operator in _aead_recvmsg() Greg KH
2024-09-16  8:38 ` Herbert Xu
2024-09-16 14:14   ` Stephan Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240916074422.503645-1-g.ryurikov@securitycode.ru \
    --to=g.ryurikov@securitycode.ru \
    --cc=davem@davemloft.net \
    --cc=grurikovsherbakov@yandex.ru \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).