Skip to content

Commit

Permalink
crypto: aesni - xts_crypt() return if walk.nbytes is 0
Browse files Browse the repository at this point in the history
xts_crypt() code doesn't call kernel_fpu_end() after calling
kernel_fpu_begin() if walk.nbytes is 0. The correct behavior should be
not calling kernel_fpu_begin() if walk.nbytes is 0.

Reported-by: [email protected]
Signed-off-by: Shreyansh Chouhan <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
BK1603 authored and herbertx committed Aug 27, 2021
1 parent cedcf52 commit 72ff2bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/crypto/aesni-intel_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ static int xts_crypt(struct skcipher_request *req, bool encrypt)
return -EINVAL;

err = skcipher_walk_virt(&walk, req, false);
if (err)
if (!walk.nbytes)
return err;

if (unlikely(tail > 0 && walk.nbytes < walk.total)) {
Expand Down

0 comments on commit 72ff2bf

Please sign in to comment.