Re: [PATCH 1/2] block/keyslot-manager: introduce devm_blk_ksm_init()
From: Ulf Hansson <hidden>
Date: 2021-01-26 13:23:56
Also in:
linux-block, linux-scsi
On Mon, 25 Jan 2021 at 22:16, Jens Axboe [off-list ref] wrote:
On 1/25/21 1:25 PM, Eric Biggers wrote:quoted
On Mon, Jan 25, 2021 at 12:14:00PM -0800, Satya Tangirala wrote:quoted
On Thu, Jan 21, 2021 at 12:23 AM Eric Biggers [off-list ref] wrote:quoted
From: Eric Biggers <redacted> 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 <redacted>[..]quoted
quoted
diff --git a/include/linux/keyslot-manager.h b/include/linux/keyslot-manager.h index 18f3f5346843f..443ad817c6c57 100644 --- a/include/linux/keyslot-manager.h +++ b/include/linux/keyslot-manager.h@@ -85,6 +85,9 @@ struct blk_keyslot_manager { int blk_ksm_init(struct blk_keyslot_manager *ksm, unsigned int num_slots); +int devm_blk_ksm_init(struct device *dev, struct blk_keyslot_manager *ksm, + unsigned int num_slots); + blk_status_t blk_ksm_get_slot_for_key(struct blk_keyslot_manager *ksm, const struct blk_crypto_key *key, struct blk_ksm_keyslot **slot_ptr); --Looks good to me. Please feel free to add Reviewed-by: Satya Tangirala <redacted>Thanks Satya. Jens, any objection to this patch going in through the MMC tree?No objections from me, doesn't look like we have any real worries of conflicts.
Applied to my mmc for the next branch, by adding Jens' ack. Thanks everybody! Kind regards Uffe