From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 250C5C83007 for ; Tue, 28 Apr 2020 18:27:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06D6420B80 for ; Tue, 28 Apr 2020 18:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588098442; bh=gvP88TuYS0Tu8ZGSBMab+0GO4uQP7gZYPcgac7x2P9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Gv7MnWs+Vtcf/Zio/nGABSIpLitxOpt2usqSNVEdfHtPj4DBA3UHFHcHz22CI3xgZ PHcbqiRhuowwVz4ZdDEzN3Lbaxs7BuHdb/BKsizAy5J4qPxiC72Cd0mfEoohRHBN4u OGhGdB+o6MJx+P2VzCYggfsHDyMRaSsBntoBD6aQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728958AbgD1S1V (ORCPT ); Tue, 28 Apr 2020 14:27:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:39360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728934AbgD1S1R (ORCPT ); Tue, 28 Apr 2020 14:27:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52C9920BED; Tue, 28 Apr 2020 18:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588098436; bh=gvP88TuYS0Tu8ZGSBMab+0GO4uQP7gZYPcgac7x2P9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqZs+31rNFCnJpqHV0pLXl7VfLfODadCdv8iTcTsSd7ixIYYqAaeLSXZO/fm/Lxnc MQi1bht7DIBjJbw49AUOms1g4bZlxwMoH1xX0mTmG7+/CxKCjbi9xSk55srZ2rLByR NpVs9LADDxEAYFk5wxa8v02LhIhgX2C3xReNvm58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Smart , Dick Kennedy , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.6 006/167] scsi: lpfc: Fix crash after handling a pci error Date: Tue, 28 Apr 2020 20:23:02 +0200 Message-Id: <20200428182226.078465299@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428182225.451225420@linuxfoundation.org> References: <20200428182225.451225420@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 4cd70891308dfb875ef31060c4a4aa8872630a2e ] Injecting EEH on a 32GB card is causing kernel oops The pci error handler is doing an IO flush and the offline code is also doing an IO flush. When the 1st flush is complete the hdwq is destroyed (freed), yet the second flush accesses the hdwq and crashes. Added a check in lpfc_sli4_fush_io_rings to check both the HBA_IOQ_FLUSH flag and the hdwq pointer to see if it is already set and not already freed. Link: https://lore.kernel.org/r/20200322181304.37655-6-jsmart2021@gmail.com Signed-off-by: James Smart Signed-off-by: Dick Kennedy Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_sli.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 5939ea0e3b1eb..de97727458fc7 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4046,6 +4046,11 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) struct lpfc_iocbq *piocb, *next_iocb; spin_lock_irq(&phba->hbalock); + if (phba->hba_flag & HBA_IOQ_FLUSH || + !phba->sli4_hba.hdwq) { + spin_unlock_irq(&phba->hbalock); + return; + } /* Indicate the I/O queues are flushed */ phba->hba_flag |= HBA_IOQ_FLUSH; spin_unlock_irq(&phba->hbalock); -- 2.20.1