summaryrefslogtreecommitdiff
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-19 07:32:44 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-19 07:32:44 -0700
commit544545e88de8a0b644b13b740b307a2f10ee0f40 (patch)
tree4fb36372aebf4688abce2f4b3d200cd731a71662 /crypto/af_alg.c
parentea2d7a962774232c5ec13f85a399e7f2a7b6746e (diff)
parent397655998b16dd121ae8963df8911d66873a0d15 (diff)
downloadlinux-crypto-544545e88de8a0b644b13b740b307a2f10ee0f40.tar.gz
linux-crypto-544545e88de8a0b644b13b740b307a2f10ee0f40.zip
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu: "This fixes an allocation error-path bug in af_alg discovered by syzkaller" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: af_alg - Initialize sg_num_bytes in error code path
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r--crypto/af_alg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 314c52c9..c166f424 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1155,8 +1155,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)