OSDN Git Service

crypto: aesni - don't use GFP_ATOMIC allocation if the request doesn't cross a page...
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 5 Sep 2018 13:18:43 +0000 (09:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:45 +0000 (11:08 -0800)
commit0b5fdbbe55754da5899431057109a26ac148700d
tree52fb6927081f649530ef09c400b00d2b286983a5
parent94c7bb6598567a663835efdbf8377ee4fbe9426d
crypto: aesni - don't use GFP_ATOMIC allocation if the request doesn't cross a page in gcm

commit a788848116454d753b13a4888e0e31ada3c4d393 upstream.

This patch fixes gcmaes_crypt_by_sg so that it won't use memory
allocation if the data doesn't cross a page boundary.

Authenticated encryption may be used by dm-crypt. If the encryption or
decryption fails, it would result in I/O error and filesystem corruption.
The function gcmaes_crypt_by_sg is using GFP_ATOMIC allocation that can
fail anytime. This patch fixes the logic so that it won't attempt the
failing allocation if the data doesn't cross a page boundary.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/crypto/aesni-intel_glue.c