Re: [PATCH] scsi: lpfc: Fix potential deadlock on &phba->hbalock

From: Justin Tee
Date: Thu Jul 27 2023 - 13:53:40 EST


Hi Chengfeng,

That’s still a unlikely scenario:

/* Check device state for handling interrupt */
if (unlikely(lpfc_intr_state_check(phba))) {
/* Check again for link_state with lock held */
spin_lock_irqsave(&phba->hbalock, iflag);
if (phba->link_state < LPFC_LINK_DOWN)
/* Flush, clear interrupt, and rearm the EQ */
lpfc_sli4_eqcq_flush(phba, fpeq);
spin_unlock_irqrestore(&phba->hbalock, iflag);
return IRQ_NONE;
}

In order to enter that if statement and obtain the hbalock, the PCI
channel has to be offline or the HBA’s link is in not in an
initialized state. If either of those were true, lpfc_cmpl_els_uvem
would never get called to begin with.

Thanks,
Justin


On Wed, Jul 26, 2023 at 10:40 PM Chengfeng Ye <dg573847474@xxxxxxxxx> wrote:
>
> Hi Justin,
>
> Thanks much for the reply, it is my negligence of not have noticed it,
> and sorry for this.
>
> I inspect the bug report of my tool again and just find that actually
> lpfc_sli4_intr_handler() also acquires that lock.
>
> lpfc_sli4_intr_handler()
> -> lpfc_sli4_hba_intr_handler()
> -> spin_lock_irqsave(&phba->hbalock, iflag);
>
> It seems like this isr is called on an SLI4 type HBA. If consider this
> one could it be a deadlock problem?
>
> Thanks again,
> Chengfeng

--
This electronic communication and the information and any files transmitted
with it, or attached to it, are confidential and are intended solely for
the use of the individual or entity to whom it is addressed and may contain
information that is confidential, legally privileged, protected by privacy
laws, or otherwise restricted from disclosure to anyone else. If you are
not the intended recipient or the person responsible for delivering the
e-mail to the intended recipient, you are hereby notified that any use,
copying, distributing, dissemination, forwarding, printing, or copying of
this e-mail is strictly prohibited. If you received this e-mail in error,
please return the e-mail to the sender, delete it from your computer, and
destroy any printed copy of it.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature