lkml.org 
[lkml]   [2018]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.18 73/92] scsi: lpfc: Fix panic if driver unloaded when port is offline
    Date
    From: James Smart <jsmart2021@gmail.com>

    [ Upstream commit d580c6137476ab307a66e278cf7dbc666230f714 ]

    System crashes when the lpfc module is unloaded after making the port
    offline

    The nvme queue pointers were freed during port offline, but were later
    accessed in pci remove path.

    Validate the pointers in pci remove path before accessing them.

    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    drivers/scsi/lpfc/lpfc_nvme.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
    index 76a5a99605aa..ada5a2aaee82 100644
    --- a/drivers/scsi/lpfc/lpfc_nvme.c
    +++ b/drivers/scsi/lpfc/lpfc_nvme.c
    @@ -2970,7 +2970,7 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba)
    struct lpfc_sli_ring *pring;
    u32 i, wait_cnt = 0;

    - if (phba->sli_rev < LPFC_SLI_REV4)
    + if (phba->sli_rev < LPFC_SLI_REV4 || !phba->sli4_hba.nvme_wq)
    return;

    /* Cycle through all NVME rings and make sure all outstanding
    @@ -2979,6 +2979,9 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba)
    for (i = 0; i < phba->cfg_nvme_io_channel; i++) {
    pring = phba->sli4_hba.nvme_wq[i]->pring;

    + if (!pring)
    + continue;
    +
    /* Retrieve everything on the txcmplq */
    while (!list_empty(&pring->txcmplq)) {
    msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1);
    --
    2.17.1
    \
     
     \ /
      Last update: 2018-09-15 03:47    [W:4.142 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site