Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dm crypt: do not call bio_endio() from the dm-crypt tasklet
Sometimes, when dm-crypt executes decryption in a tasklet, we may get "BUG: KASAN: use-after-free in tasklet_action_common.constprop..." with a kasan-enabled kernel. When the decryption fully completes in the tasklet, dm-crypt will call bio_endio(), which in turn will call clone_endio() from dm.c core code. That function frees the resources associated with the bio, including per bio private structures. For dm-crypt it will free the current struct dm_crypt_io, which contains our tasklet object, causing use-after-free, when the tasklet is being dequeued by the kernel. To avoid this, do not call bio_endio() from the current tasklet context, but delay its execution to the dm-crypt IO workqueue. Fixes: 39d42fa ("dm crypt: add flags to optionally bypass kcryptd workqueues") Cc: <[email protected]> # v5.9+ Signed-off-by: Ignat Korchagin <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
- Loading branch information