Skip to content

Commit c4bfed8

Browse files
smuellerDDgregkh
authored andcommitted
crypto: af_alg - Initialize sg_num_bytes in error code path
commit 2546da9 upstream. 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 <[email protected]> Reported-by: [email protected] #syz test: https://github.com/google/kmsan.git master CC: <[email protected]> #4.14 Fixes: e870456 ("crypto: algif_skcipher - overhaul memory management") Fixes: d887c52 ("crypto: algif_aead - overhaul memory management") Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 16b3ae1 commit c4bfed8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crypto/af_alg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,10 @@ int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags,
11831183

11841184
/* make one iovec available as scatterlist */
11851185
err = af_alg_make_sg(&rsgl->sgl, &msg->msg_iter, seglen);
1186-
if (err < 0)
1186+
if (err < 0) {
1187+
rsgl->sg_num_bytes = 0;
11871188
return err;
1189+
}
11881190

11891191
/* chain the new scatterlist with previous one */
11901192
if (areq->last_rsgl)

0 commit comments

Comments
 (0)