block/keyslot-manager: introduce devm_blk_ksm_init()
authorEric Biggers <ebiggers@google.com>
Thu, 21 Jan 2021 08:21:54 +0000 (00:21 -0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Feb 2021 10:56:18 +0000 (11:56 +0100)
commit5851d3b042b694839d2241fbb3200ce958135cdf
treec399d0eeeca923f0e72458fa24d929f3fd751edd
parent4af307f574260cb1b768be84c81ce572da7a84ea
block/keyslot-manager: introduce devm_blk_ksm_init()

Add a resource-managed variant of blk_ksm_init() so that drivers don't
have to worry about calling blk_ksm_destroy().

Note that the implementation uses a custom devres action to call
blk_ksm_destroy() rather than switching the two allocations to be
directly devres-managed, e.g. with devm_kmalloc().  This is because we
need to keep zeroing the memory containing the keyslots when it is
freed, and also because we want to continue using kvmalloc() (and there
is no devm_kvmalloc()).

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Satya Tangirala <satyat@google.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20210121082155.111333-2-ebiggers@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Documentation/block/inline-encryption.rst
block/keyslot-manager.c
include/linux/keyslot-manager.h