All of lore.kernel.org
 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 v2] AF_ALG: Initialize sg_num_bytes in error code path
Date: Thu, 05 Jul 2018 17:58:15 +0200	[thread overview]
Message-ID: <3579823.yyIR4au8HA@positron.chronox.de> (raw)
In-Reply-To: <00000000000092ad87056950ef9e@google.com>

Changes v2:
* Addition of syz testing line

---8<---

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
#syz test: https://github.com/google/kmsan.git
---
 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 49fa8582138b..bd6795ff406a 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1148,8 +1148,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.17.1

  parent reply	other threads:[~2018-07-05 15:58 UTC|newest]

Thread overview: 31+ 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 ` [PATCH] AF_ALG: register completely initialized request in list Stephan Müller
2018-04-09  7:51   ` 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  8:43             ` Dmitry Vyukov
2018-07-05 15:58 ` Stephan Müller [this message]
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:38         ` Dmitry Vyukov
2018-07-06  7:41         ` Stephan Mueller
2018-07-06  7:41           ` Stephan Mueller
2018-07-06  7:44           ` Dmitry Vyukov
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  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  8:19       ` Dmitry Vyukov
2018-07-06 15:30       ` Dmitry Vyukov
2018-07-06 15:55         ` syzbot
2018-07-06 16:27       ` Stephan Mueller
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=3579823.yyIR4au8HA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.