Skip to content

blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer - #1126

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1144347=>linus-master
Open

blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer#1126
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1144347=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown

Pull request for series with
subject: blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1144347

@blktests-ci

blktests-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: d58772d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci

blktests-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: f5bbbfe
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1144347=>linus-master branch from 40f28d7 to 23996c7 Compare August 12, 2026 13:34
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from ea2c39d to 4082a30 Compare August 12, 2026 18:56
@blktests-ci

blktests-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3d6d817
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1144347=>linus-master branch from 23996c7 to 1aceaca Compare August 12, 2026 19:22
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from 4082a30 to 36bd7eb Compare August 13, 2026 19:18
@blktests-ci

blktests-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3aa1dca
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1144347=>linus-master branch from 1aceaca to 43555da Compare August 13, 2026 19:25
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from d89ab11 to fdba928 Compare August 16, 2026 18:34
@blktests-ci

blktests-ci Bot commented Aug 16, 2026

Copy link
Copy Markdown
Author

Upstream branch: fd923b3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1144347=>linus-master branch from 43555da to e216f17 Compare August 16, 2026 19:38
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from fdba928 to 60442a3 Compare August 17, 2026 14:10
Encrypting a large bio with more than BIO_MAX_VECS pages can still
deadlock, even after it was attempted to be fixed by
commit b37fbce ("blk-crypto: optimize bio splitting in
blk_crypto_fallback_encrypt_bio") and commit 3d93969 ("blk-crypto:
use mempool_alloc_bulk for encrypted bio page allocation").

This is because __blk_crypto_fallback_encrypt_bio() assumes that the
bounce bios that it submits will eventually complete, unblocking it from
allocating additional bounce bios and pages.  However, dm-inlinecrypt.c
calls __blk_crypto_submit_bio() from within submit_bio() itself.  In
this case, the recursive submit_bio() simply adds the bounce bio to
current->bio_list without actually submitting it yet.  That breaks the
guarantee that forward progress is being made.

To fix this, allocate the bio and bounce pages with GFP_NOWAIT if
current->bio_list is set.  If it fails, punt the encryption of the
remaining part of the bio to a kworker.

Fixes: 488f668 ("block: blk-crypto-fallback for Inline Encryption")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
@blktests-ci

blktests-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 8d3ae59
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144347
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1144347=>linus-master branch from e216f17 to be1c5e5 Compare August 17, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants