From patchwork Mon May 15 19:31:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 9727807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27D8360386 for ; Mon, 15 May 2017 19:31:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A40B2896B for ; Mon, 15 May 2017 19:31:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E8B8289BF; Mon, 15 May 2017 19:31:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A56362896B for ; Mon, 15 May 2017 19:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965085AbdEOTbl (ORCPT ); Mon, 15 May 2017 15:31:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34806 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933207AbdEOTbl (ORCPT ); Mon, 15 May 2017 15:31:41 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4FJVCm5038004 for ; Mon, 15 May 2017 15:31:40 -0400 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 2afjhsr0gf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 15 May 2017 15:31:39 -0400 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 May 2017 16:31:37 -0300 Received: from d24relay03.br.ibm.com (9.18.232.225) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 15 May 2017 16:31:36 -0300 Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4FJVZGK29753410 for ; Mon, 15 May 2017 16:31:35 -0300 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v4FJVaeZ017140 for ; Mon, 15 May 2017 16:31:36 -0300 Received: from localhost ([9.85.206.113]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v4FJVYXi017136; Mon, 15 May 2017 16:31:35 -0300 From: "Guilherme G. Piccoli" To: linux-scsi@vger.kernel.org Cc: raphasil@linux.vnet.ibm.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, gpiccoli@linux.vnet.ibm.com Subject: Re: [PATCH 02/15] lpfc: Fix system crash when port is reset. Date: Mon, 15 May 2017 16:31:32 -0300 X-Mailer: git-send-email 2.12.0.rc0 In-Reply-To: <20170510190713.30171-3-jsmart2021@gmail.com> References: <20170510190713.30171-3-jsmart2021@gmail.com> X-TM-AS-MML: disable x-cbid: 17051519-0032-0000-0000-0000055E9C17 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051519-0033-0000-0000-000011E3F7CB Message-Id: <20170515193132.22385-1-gpiccoli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-15_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705150184 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi James and Dick, thanks for this patch. We were investigating a pretty similar issue, and we raised a patch that looks like yours. Since you sent this one, we reviewed and seems it's missing a hunk to prevent the issue we are dealing here, in PCI error recovery. Please see the attached patch. Basically, lpfc is dereferencing a NULL pointer on PCI error recovery path in lpfc_els_flush_cmd(). Feel free to take this hunk on your patch, or if you prefer we can send a complete patch. Thanks in advance, Guilherme --- drivers/scsi/lpfc/lpfc_els.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 67827e397431..4e354194cb54 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -7441,6 +7441,13 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) */ spin_lock_irq(&phba->hbalock); pring = lpfc_phba_elsring(phba); + + /* Bail out if we've no ELS wq, like in PCI error recovery case. */ + if (unlikely(!pring)) { + spin_unlock_irq(&phba->hbalock); + return; + } + if (phba->sli_rev == LPFC_SLI_REV4) spin_lock(&pring->ring_lock);