Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: af_alg - Fix page reassignment overflow in af_alg_pull_tsgl

When page reassignment was added to af_alg_pull_tsgl the original
loop wasn't updated so it may try to reassign one more page than
necessary.

Add the check to the reassignment so that this does not happen.

Also update the comment which still refers to the obsolete offset
argument.

Reported-by: syzbot+d23888375c2737c17ba5@syzkaller.appspotmail.com
Fixes: e870456d8e7c ("crypto: algif_skcipher - overhaul memory management")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+2 -2
+2 -2
crypto/af_alg.c
··· 705 705 * Assumption: caller created af_alg_count_tsgl(len) 706 706 * SG entries in dst. 707 707 */ 708 - if (dst) { 709 - /* reassign page to dst after offset */ 708 + if (dst && plen) { 709 + /* reassign page to dst */ 710 710 get_page(page); 711 711 sg_set_page(dst + j, page, plen, sg[i].offset); 712 712 j++;