Re: [PATCH v3 1/1] scsi: core: Fix error handler encryption support
From: Bart Van Assche
Date: Fri Dec 19 2025 - 11:49:52 EST
On 12/17/25 7:17 PM, Po-Wen Kao wrote:
Some low-level drivers (LLD) access block layer crypto fields, such as
rq->crypt_keyslot and rq->crypt_ctx within `struct request`, to
configure hardware for inline encryption.
However, SCSI Error Handling (EH) commands (e.g., TEST UNIT READY,
START STOP UNIT) should not involve any encryption setup.
To prevent drivers from erroneously applying crypto settings during EH,
this patch saves the original values of rq->crypt_keyslot and
rq->crypt_ctx before an EH command is prepared via scsi_eh_prep_cmnd().
These fields in the `struct request` are then set to NULL.
The original values are restored in scsi_eh_restore_cmnd() after the EH
command completes.
This ensures that the block layer crypto context does not leak into
EH command execution.
Signed-off-by: Brian Kao <powenkao@xxxxxxxxxx>
Hi Martin,
Please add the following to this patch:
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
Thanks,
Bart.