Re: [PATCH v3 1/2] scsi: ufs: core: Avoid unsafe MMIO reads in ufshcd_mcq_compl_all_cqes_lock()

From: Bart Van Assche

Date: Mon Sep 28 2026 - 13:55:04 EST


On 9/27/26 8:58 PM, Stanley Jhu wrote:
Fix both issues in ufshcd_mcq_compl_all_cqes_lock():
- Remove the ufshcd_mcq_update_cq_tail_slot() call and the redundant
hwq->cq_head_slot = hwq->cq_tail_slot assignment without
replacement. The two indices are already equal after the sweep: they
are equal when the sweep starts, since ufshcd_mcq_poll_cqe_lock()
consumes entries until cq_head_slot reaches cq_tail_slot, and the
sweep advances cq_head_slot by exactly one full ring. Both indices
are also reinitialized before the queue is reused.
- Extract ufshcd_mcq_compl_cqe() and invoke it only on non-empty slots
during full-ring sweeps, keeping "Abnormal CQ entry!" logging strictly
for unexpected empty entries in ufshcd_mcq_poll_cqe_lock().

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>