Skip to content

Commit e117765

Browse files
smuellerDDherbertx
authored andcommitted
crypto: af_alg - update correct dst SGL entry
When two adjacent TX SGL are processed and parts of both TX SGLs are pulled into the per-request TX SGL, the wrong per-request TX SGL entries were updated. This fixes a NULL pointer dereference when a cipher implementation walks the TX SGL where some of the SGL entries were NULL. Fixes: e870456 ("crypto: algif_skcipher - overhaul memory...") Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent c056d91 commit e117765

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crypto/af_alg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,14 +619,14 @@ void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *dst,
619619
struct af_alg_ctx *ctx = ask->private;
620620
struct af_alg_tsgl *sgl;
621621
struct scatterlist *sg;
622-
unsigned int i, j;
622+
unsigned int i, j = 0;
623623

624624
while (!list_empty(&ctx->tsgl_list)) {
625625
sgl = list_first_entry(&ctx->tsgl_list, struct af_alg_tsgl,
626626
list);
627627
sg = sgl->sg;
628628

629-
for (i = 0, j = 0; i < sgl->cur; i++) {
629+
for (i = 0; i < sgl->cur; i++) {
630630
size_t plen = min_t(size_t, used, sg[i].length);
631631
struct page *page = sg_page(sg + i);
632632

0 commit comments

Comments
 (0)