Re: [PATCH v2] scsi: ufs: core: Fix NULL pointer dereference in scsi_cmd_priv() calls
From: Bart Van Assche
Date: Fri May 29 2026 - 13:50:07 EST
On 5/28/26 6:07 PM, Chanwoo Lee wrote:
ufshcd_tag_to_cmd() may return NULL if no command is associated with
the given tag. However, several callers dereference the returned cmd
pointer via scsi_cmd_priv() without checking for NULL first, leading
to a potential NULL pointer dereference.
Fix this by adding NULL checks for cmd before calling scsi_cmd_priv()
and moving the lrbp initialization after the NULL check.
Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>