Skip to content

Fix blk-crypto keyslot race condition

Eric Biggers linux-block linux-fscrypt stable 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 9 repliesApplied
  2. v24 patches 9 repliesSuperseded
  3. v13 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- 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()

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/6blk-mq: release crypto keyslot before reporting I/O completeblock/blk-crypto-internal.h block/blk-crypto.c block/blk-merge.c +1 more+49 -170 replies
2/6blk-crypto: make blk_crypto_evict_key() return voidblock/blk-crypto.c drivers/md/dm-table.c include/linux/blk-crypto.h+16 -271 reply
3/6blk-crypto: make blk_crypto_evict_key() more robustblock/blk-crypto-profile.c block/blk-crypto.c+41 -331 reply
4/6blk-crypto: remove blk_crypto_insert_cloned_request()Documentation/block/inline-encryption.rst block/blk-crypto-internal.h block/blk-mq.c+2 -181 reply
5/6blk-mq: return actual keyslot error in blk_insert_cloned_request()block/blk-mq.c+3 -25 replies
6/6blk-crypto: drop the NULL check from blk_crypto_put_keyslot()block/blk-crypto-profile.c+4 -100 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchNathan HuckleberryChristoph Hellwig
1/6R-b R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/6] Fix blk-crypto keyslot race condition

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/[email protected]),
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

Signature · 1 line
2.39.2