Skip to content

Commit 4609ed8

Browse files
yangdepeiopsiff
authored andcommitted
x86/crypto: fix scatterwalk_unmap issue in cis sm4 driver
Signed-off-by: yangdepei <yangdepei@hygon.cn> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent b1ba45b commit 4609ed8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

arch/x86/crypto/sm4_cis_glue.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,12 @@ static int sm4_gcm_do_crypt(struct aead_request *req, bool encrypt)
773773
if (zfilled)
774774
crypto_shash_update(cis_ctx->ghash_desc, pad, zfilled);
775775

776+
if (!assocmem)
777+
scatterwalk_unmap(assoc);
778+
else
779+
kfree(assocmem);
776780
}
777781

778-
if (!assocmem)
779-
scatterwalk_unmap(assoc);
780-
else
781-
kfree(assocmem);
782-
783782
err = encrypt ? skcipher_walk_aead_encrypt(&walk, req, false)
784783
: skcipher_walk_aead_decrypt(&walk, req, false);
785784
if (err)

0 commit comments

Comments
 (0)