linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stephan Müller" <smueller@chronox.de>
To: syzbot <syzbot+9c251bdd09f83b92ba95@syzkaller.appspotmail.com>
Cc: davem@davemloft.net, herbert@gondor.apana.org.au,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: [PATCH] AF_ALG: register completely initialized request in list
Date: Sun, 08 Apr 2018 19:57:12 +0200	[thread overview]
Message-ID: <3337259.MW9pfDCdka@positron.chronox.de> (raw)
In-Reply-To: <00000000000092ad87056950ef9e@google.com>

Hi,

May I ask to check whether this patch fixes the issue? I cannot re-create
the issue with the reproducter. Yet, as far as I understand, you try to
induce errors which shall validate whether the error code paths are correct.

The fix below should ensure this now.

Thanks a lot.

---8<---

>From 8f083e7b0684a9f91c186d7b46eec34e439689c3 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Sun, 8 Apr 2018 19:53:59 +0200
Subject: [PATCH] AF_ALG: Initialize sg_num_bytes in error code path

The RX SGL in processing is already registered with the RX SGL tracking
list to support proper cleanup. The cleanup code path uses the
sg_num_bytes variable which must therefore be always initialized, even
in the error code path.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Reported-by: syzbot+9c251bdd09f83b92ba95@syzkaller.appspotmail.com
---
 crypto/af_alg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index c49766b03165..0d555c072669 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1156,8 +1156,10 @@ int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags,
 
 		/* make one iovec available as scatterlist */
 		err = af_alg_make_sg(&rsgl->sgl, &msg->msg_iter, seglen);
-		if (err < 0)
+		if (err < 0) {
+			rsgl->sg_num_bytes = 0;
 			return err;
+		}
 
 		/* chain the new scatterlist with previous one */
 		if (areq->last_rsgl)
-- 
2.14.3

  reply	other threads:[~2018-04-08 17:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08  7:07 KMSAN: uninit-value in af_alg_free_areq_sgls syzbot
2018-04-08 17:57 ` Stephan Müller [this message]
2018-04-09  7:51   ` [PATCH] AF_ALG: register completely initialized request in list Dmitry Vyukov
2018-04-09  7:54     ` Stephan Mueller
2018-07-04 23:37       ` Eric Biggers
2018-07-05  7:49         ` Stephan Müller
2018-07-05  8:43           ` Dmitry Vyukov
2018-07-05 15:58 ` [PATCH v2] AF_ALG: Initialize sg_num_bytes in error code path Stephan Müller
2018-07-05 17:02   ` KMSAN: uninit-value in af_alg_free_areq_sgls syzbot
2018-07-05 18:45     ` Stephan Müller
2018-07-06  7:38       ` Dmitry Vyukov
2018-07-06  7:41         ` Stephan Mueller
2018-07-06  7:44           ` Dmitry Vyukov
2018-07-06  7:50 ` [PATCH v3] AF_ALG: Initialize sg_num_bytes in error code path Stephan Müller
2018-07-06  7:58   ` Dmitry Vyukov
2018-07-06  8:09   ` KMSAN: uninit-value in af_alg_free_areq_sgls syzbot
2018-07-06  8:19     ` Dmitry Vyukov
2018-07-06 16:27       ` Stephan Mueller
2018-07-06 21:57   ` [PATCH v3] AF_ALG: Initialize sg_num_bytes in error code path Eric Biggers
2018-07-07 18:41 ` [PATCH v4] " Stephan Müller
2018-07-07 19:01   ` KMSAN: uninit-value in af_alg_free_areq_sgls syzbot
2018-07-13 10:34   ` [PATCH v4] AF_ALG: Initialize sg_num_bytes in error code path Herbert Xu

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=3337259.MW9pfDCdka@positron.chronox.de \
    --to=smueller@chronox.de \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+9c251bdd09f83b92ba95@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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).