]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: scomp - Fix wild memory accesses in scomp_free_streams
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Apr 2025 01:26:47 +0000 (09:26 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 12 Apr 2025 01:33:09 +0000 (09:33 +0800)
commit9ae0c92fec69374c6db8dddb0df00d86b9afa5da
tree9ed34712affa77bcd15a64562c64697bf608e125
parentb7b39df7e710b0068356e4c696af07aa10e2cd3d
crypto: scomp - Fix wild memory accesses in scomp_free_streams

In order to use scomp_free_streams to free the partially allocted
streams in the allocation error path, move the alg->stream assignment
to the beginning.  Also check for error pointers in scomp_free_streams
before freeing the ctx.

Finally set alg->stream to NULL to not break subsequent attempts
to allocate the streams.

Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Co-developed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Co-developed-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/scompress.c