OSDN Git Service

dm verity: fix crash on bufio buffer that was allocated with vmalloc
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 22 Aug 2018 16:45:51 +0000 (12:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:39:32 +0000 (08:39 +0200)
commit59efbbc9a611aa6c77940ef814543f370bcc4ab2
treec9fc2d5bcec6f91468cb9dd49655a29135f9d2d1
parentf5f0f2ad7099ccc632b165231122b4263bef80e7
dm verity: fix crash on bufio buffer that was allocated with vmalloc

commit e4b069e0945fa14c71cf8b5b89f8b1b2aa68dbc2 upstream.

Since commit d1ac3ff008fb ("dm verity: switch to using asynchronous hash
crypto API") dm-verity uses asynchronous crypto calls for verification,
so that it can use hardware with asynchronous processing of crypto
operations.

These asynchronous calls don't support vmalloc memory, but the buffer data
can be allocated with vmalloc if dm-bufio is short of memory and uses a
reserved buffer that was preallocated in dm_bufio_client_create().

Fix verity_hash_update() so that it deals with vmalloc'd memory
correctly.

Reported-by: "Xiao, Jin" <jin.xiao@intel.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: d1ac3ff008fb ("dm verity: switch to using asynchronous hash crypto API")
Cc: stable@vger.kernel.org # 4.12+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-verity-target.c