diff options
author | Stephan Mueller <smueller@chronox.de> | 2018-07-07 14:41:47 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-07-13 06:24:23 -0400 |
commit | 2546da99212f22034aecf279da9c47cbfac6c981 (patch) | |
tree | e7812d62c3febd6ce73707e9442610253e8a774b | |
parent | 221e00d1fce976d8a04ff591a0150caf84e176f8 (diff) |
crypto: 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
#syz test: https://github.com/google/kmsan.git master
CC: <stable@vger.kernel.org> #4.14
Fixes: e870456d8e7c ("crypto: algif_skcipher - overhaul memory management")
Fixes: d887c52d6ae4 ("crypto: algif_aead - overhaul memory management")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/af_alg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 7846c0c20cfe..b52a14fc3bae 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, | |||
1156 | 1156 | ||
1157 | /* make one iovec available as scatterlist */ | 1157 | /* make one iovec available as scatterlist */ |
1158 | err = af_alg_make_sg(&rsgl->sgl, &msg->msg_iter, seglen); | 1158 | err = af_alg_make_sg(&rsgl->sgl, &msg->msg_iter, seglen); |
1159 | if (err < 0) | 1159 | if (err < 0) { |
1160 | rsgl->sg_num_bytes = 0; | ||
1160 | return err; | 1161 | return err; |
1162 | } | ||
1161 | 1163 | ||
1162 | /* chain the new scatterlist with previous one */ | 1164 | /* chain the new scatterlist with previous one */ |
1163 | if (areq->last_rsgl) | 1165 | if (areq->last_rsgl) |