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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 B75ABC38A2F for ; Sat, 18 Apr 2020 14:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97FBE22250 for ; Sat, 18 Apr 2020 14:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587218967; bh=ph0iQQL/AbdQ9iyH2X+nCR5kmfMMJ5dzpVPItmfr5Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nNIujU9iP5CvOHvWw5xdHgO0luBKuQ+3xPVPkfSdZjutnJOUzANdkTf3UDEu6DyjV JNDfgeFIshU12vJw4dJIhlZPzt/Ak5CSimyMhY1RgOtBw4odfckbcklrsx43KgHWv6 M9Di1CtkZoBpF3TDufkhm+TkI+/UdsXEmmea6Uy0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726399AbgDROJX (ORCPT ); Sat, 18 Apr 2020 10:09:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:36680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbgDROJX (ORCPT ); Sat, 18 Apr 2020 10:09:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1ECE221BE5; Sat, 18 Apr 2020 14:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587218962; bh=ph0iQQL/AbdQ9iyH2X+nCR5kmfMMJ5dzpVPItmfr5Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=edo3TLT8KEc3e6C7tue/mZiTpVHl7yJJT7KjDVDnGOdE2KyQ4uWLu1JQphQDn3jHS fXu8SYXB4J2bQhYYIsnKhAAm5QQfISy1LwLuR9D1ARyXwC2NzN18w3XK12nnFZTqhe BfosbJqMyhXac7he3IGf+OztvC1CEpATm2HhC4hI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Dick Kennedy , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 10/75] scsi: lpfc: Fix crash after handling a pci error Date: Sat, 18 Apr 2020 10:08:05 -0400 Message-Id: <20200418140910.8280-10-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418140910.8280-1-sashal@kernel.org> References: <20200418140910.8280-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 993b1056beb83..909554c7c1273 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