Re: [PATCH v2] scsi: libsas: Fix use-after-free in sas_eh_handle_resets()
From: James Bottomley
Date: Sat Nov 07 2026 - 11:21:22 EST
On Sat, 2026-11-07 at 14:53 +0000, Wentao Liang wrote:
> sas_eh_handle_resets() drops the reference it took on the domain
> device with sas_put_device() and then accesses dev->state again while
> holding ha->lock. The put may release the last reference, so the
> clear_bit() can touch freed memory.
>
> Clear the pending flag before dropping the reference.
>
> The candidate was found with static analysis tools; DeepSeek and GPT-
> 6.1 Sol were used to audit it and to help prepare this fix.
>
> Fixes: 5db45bdc87ce ("[SCSI] libsas: enforce eh strategy handlers
> only in eh context")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
You just adopted the patch John sent wholesale, so the signoff above is
now wrong and you either need his signoff or at least a Co-developed-
by.
I get that this change is likely too small to have copyright
implications, but you want to make sure your process works in cases
where it does matter.
Regards,
James