mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 05:42:46 +01:00
crypto: scompress - Fix scratch allocation failure handling
If the scratch allocation fails, all subsequent allocations will
silently succeed without actually allocating anything. Fix this
by only incrementing users when the allocation succeeds.
Fixes: 6a8487a1f2 ("crypto: scompress - defer allocation of scratch buffer to first use")
Signed-off-by: Herbert Xu <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
This commit is contained in:
1 parent
7e0969bae4
commit
ddd0a42671
1 file changed
+5
-1
+5
-1
@@ -159,8 +159,12 @@ static int crypto_scomp_init_tfm(struct crypto_tfm *tfm)
|
||||
if (ret)
|
||||
goto unlock;
|
||||
}
|
||||
if (!scomp_scratch_users++)
|
||||
if (!scomp_scratch_users) {
|
||||
ret = crypto_scomp_alloc_scratches();
|
||||
if (ret)
|
||||
goto unlock;
|
||||
scomp_scratch_users++;
|
||||
}
|
||||
unlock:
|
||||
mutex_unlock(&scomp_lock);
|
||||
|
||||
|
||||
Reference in new issue
Block a user