Re: [PATCH] scsi: ufs: rpmb: Return -EIO instead of SCSI result on failure
From: Bean Huo
Date: Thu Nov 26 2026 - 13:48:58 EST
On Tue, 2026-11-24 at 13:52 +0900, Nayeon Kim via B4 Relay wrote:
> From: Nayeon Kim <nayeoni.kim@xxxxxxxxxxx>
>
> rpmb_route_frames() is documented to return a negative errno on
> failure, but ufs_sec_submit() returns the value of scsi_execute_cmd()
> as is. When a SECURITY PROTOCOL IN/OUT command fails, that value is a
> positive SCSI result such as SAM_STAT_CHECK_CONDITION or
> DID_ERROR << 16. ufs_rpmb_route_frames() passes it up and logs it as
> "ret=%d". Since scsi_execute_cmd() sets RQF_QUIET, the sense data is
> not logged anywhere.
>
> handle_rpc_func_rpmb_frames(), the only caller of rpmb_route_frames(),
> checks for a non-zero return, so OP-TEE still sees the failure.
>
> Log the SCSI result and sense data in ufs_sec_submit() and convert
> positive results to -EIO, as ufshcd_set_dev_pwr_mode() does.
>
> Signed-off-by: Nayeon Kim <nayeoni.kim@xxxxxxxxxxx>
> ---
> Based on 7.4/scsi-fixes because it depends on commit 7bc9b854cd68
> ("scsi: ufs: rpmb: Decouple device lifecycle from devres to avoid UAF").
> Not urgent; fine for 7.5. Compile-tested (W=1) only.
> ---
this time sashiko is right, you need to add a fixes tag.
Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS
devices")
Reviewed-by: Bean Huo <beanhuo@xxxxxxxxxx>
Kind regards,
Bean