mbox series

[v3,0/6] Fix blk-crypto keyslot race condition

Message ID 20230315183907.53675-1-ebiggers@kernel.org (mailing list archive)
Headers show
Series Fix blk-crypto keyslot race condition | expand

Message

Eric Biggers March 15, 2023, 6:39 p.m. UTC
This series fixes a race condition in blk-crypto keyslot management and
makes some related cleanups.  It replaces
"[PATCH] blk-crypto: make blk_crypto_evict_key() always try to evict"
(https://lore.kernel.org/r/20230226203816.207449-1-ebiggers@kernel.org),
which was a simpler fix but didn't fix the keyslot reference counting to
work as expected.

Changed in v3:
  - Add a patch that makes blk_crypto_evict_key() return void
  - Add a patch that makes blk_insert_cloned_request() pass on the
    actual error code from blk_crypto_rq_put_keyslot()
  - Use gotos in __blk_crypto_evict_key()

Changed in v2:
  - Call blk_crypto_rq_put_keyslot() when requests are merged
  - Add and use blk_crypto_rq_has_keyslot()
  - Add patch "blk-crypto: drop the NULL check from blk_crypto_put_keyslot()"

Eric Biggers (6):
  blk-mq: release crypto keyslot before reporting I/O complete
  blk-crypto: make blk_crypto_evict_key() return void
  blk-crypto: make blk_crypto_evict_key() more robust
  blk-crypto: remove blk_crypto_insert_cloned_request()
  blk-mq: return actual keyslot error in blk_insert_cloned_request()
  blk-crypto: drop the NULL check from blk_crypto_put_keyslot()

 Documentation/block/inline-encryption.rst |  3 +-
 block/blk-crypto-internal.h               | 38 ++++++-------
 block/blk-crypto-profile.c                | 60 +++++++++------------
 block/blk-crypto.c                        | 66 +++++++++++++----------
 block/blk-merge.c                         |  2 +
 block/blk-mq.c                            | 20 +++++--
 drivers/md/dm-table.c                     | 19 ++-----
 include/linux/blk-crypto.h                |  4 +-
 8 files changed, 110 insertions(+), 102 deletions(-)


base-commit: eeac8ede17557680855031c6f305ece2378af326

Comments

Jens Axboe March 16, 2023, 3:35 p.m. UTC | #1
On Wed, 15 Mar 2023 11:39:01 -0700, Eric Biggers wrote:
> This series fixes a race condition in blk-crypto keyslot management and
> makes some related cleanups.  It replaces
> "[PATCH] blk-crypto: make blk_crypto_evict_key() always try to evict"
> (https://lore.kernel.org/r/20230226203816.207449-1-ebiggers@kernel.org),
> which was a simpler fix but didn't fix the keyslot reference counting to
> work as expected.
> 
> [...]

Applied, thanks!

[1/6] blk-mq: release crypto keyslot before reporting I/O complete
      (no commit info)
[2/6] blk-crypto: make blk_crypto_evict_key() return void
      (no commit info)
[3/6] blk-crypto: make blk_crypto_evict_key() more robust
      (no commit info)
[4/6] blk-crypto: remove blk_crypto_insert_cloned_request()
      (no commit info)
[5/6] blk-mq: return actual keyslot error in blk_insert_cloned_request()
      (no commit info)
[6/6] blk-crypto: drop the NULL check from blk_crypto_put_keyslot()
      (no commit info)

Best regards,