Re: [PATCH v2] scsi: lpfc: Fix race conditions in ELS retry
From: Martin K. Petersen
Date: Fri Oct 30 2026 - 21:32:07 EST
Kyle,
> This patch addresses a race condition in the lpfc driver's ELS retry
> event handling that can lead to a use-after-free in the
> lpfc_cancel_retry_delay_tmo(), where the NLP_DELAY_TMO flag is cleared
> before acquiring the lock to check if the retry event is queued. This
> creates a window where the timer can be rescheduled and fire, causing
> both the cancel path and the worker thread to release the same
> reference, resulting in a double-put and use-after-free.
AI review commentary:
- **High:** the worker clears `evt_arg1` after unlocking, potentially
erasing a requeued event’s payload and causing a NULL dereference.
Capture and clear it under `hbalock` during dequeue.
- **Low:** missing Fixes tag for `e47c9093531d`.
The mailbox is also line-wrapped and fails `git apply --check`.
Please fix, thanks!
--
Martin K. Petersen