Skip to content

Commit

Permalink
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Jul 19, 2018
2 parents 024ddc0 + 2546da9 commit b4394c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b4394c3

Please sign in to comment.