Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4476270ybz; Tue, 28 Apr 2020 11:57:37 -0700 (PDT) X-Google-Smtp-Source: APiQypJTl3opkph56jzOslPGYSGwtiM0MLyaXSPhkE00mbrbHS5haDFtNSLLJuOIIecpVLcIIC7R X-Received: by 2002:a17:907:42d6:: with SMTP id ng6mr25523623ejb.265.1588100257674; Tue, 28 Apr 2020 11:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588100257; cv=none; d=google.com; s=arc-20160816; b=IfBH/Uz4O1oMT5ExAX1OsXzcQhTnCUql3zOAXApab/aEwXkzSodSqI8uoUhgHoA+mv LdI22BhmS3rF1sMRkqQ6UzIb5AkV3P5O80WEBqZFvtV+L/yT5PQClXirplkHFU7dNcU+ ewZ4JgHltsf285ubZpgp2d7KIwsu6agNxvxghxB7ZbbRNJs+U/c0jWuJq3DiRepSTt6x aJj02qlCVmc6BS9st05rtjHUOTg8dVQxgqwf5oClGYzMdTuEnPq6CcCxfw5r7JCyYwWX qcf2I3RQ59+R1PBjdB+8CRwKhXc1F8BNh5hH9R2qk2cKTZSt/fMCsovZVC9a/B9WGXHh vjpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LVgm8aj1cDIq8ziHwysHzGNfLwMRX00FsbMvweVYa/c=; b=NT5TrgwiukIV6LuKSWHAgSj2NP8ZZFSjthNVdt7PXNTwgrhMG5xw5olC3oAePJ0Rkh OUVlR3UU2KT92tz7dec/BZ9UuSiZuWZUc1RTTcczpFgo9mW7QUA3sAHh4y7VSRcVJv2m FBDia7AqU26mDbFIKuSm7v7vojxdFqeMK18Ibrjq6z2ATmSJ79buUjj0Z9uhA+5j047v H27lsnIw45Q+WMWMfkhgX/ey2NTR+9njuZm9geKBRaiE4DJWwKVMuIUFHPfKtMkU0OOh YZp8xUUZpWY4dJ85W8JWUkfP4epWDpM5O6Z87tRxqtH2n5wZz+4JXvUs98e81FGvPA0a ZjKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y1uGqttD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si2087798edf.138.2020.04.28.11.57.14; Tue, 28 Apr 2020 11:57:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y1uGqttD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730070AbgD1Sx7 (ORCPT + 99 others); Tue, 28 Apr 2020 14:53:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:51378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730064AbgD1See (ORCPT ); Tue, 28 Apr 2020 14:34:34 -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 6673821707; Tue, 28 Apr 2020 18:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588098873; bh=2ljyNe12FS2y0Tkn2bvU7tbSgoTZOjBeAZoiWEP65sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y1uGqttDn81bna15sFbJYKQksHitx6PhE1azjPctOWywTMjpx7OwQ6liMaDsT5g4x XaUV0VnEtZkwySdAuqiFJZwgaUITCJW5Bb1PCO8EtFhDFvrq1m9H2L+28u1+TFu08q mivJ3IjikCnmhs2euvQ1XJpKJdIUZWbpgSnk1KUc= 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.4 011/168] scsi: lpfc: Fix crash after handling a pci error Date: Tue, 28 Apr 2020 20:23:05 +0200 Message-Id: <20200428182233.120645460@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428182231.704304409@linuxfoundation.org> References: <20200428182231.704304409@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 1692ce913b7f0..a951e1c8165ed 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4013,6 +4013,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