From patchwork Fri Sep 22 06:17:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9965237 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 1F487602D8 for ; Fri, 22 Sep 2017 06:18:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0998029707 for ; Fri, 22 Sep 2017 06:18:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2D9E2970B; Fri, 22 Sep 2017 06:18:20 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 A698329707 for ; Fri, 22 Sep 2017 06:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751885AbdIVGSR (ORCPT ); Fri, 22 Sep 2017 02:18:17 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36743 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbdIVGSK (ORCPT ); Fri, 22 Sep 2017 02:18:10 -0400 Received: by mail-pg0-f68.google.com with SMTP id d8so120665pgt.3 for ; Thu, 21 Sep 2017 23:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bvYghq4E44tobiCXSw20DL/ja5986RjMD/NlIgq82uk=; b=Qle6jcNygyX98ol0PboXYYbs+C84GZWYLjufm1d9y7Qcj03v9bBsqz6aiX2vyc6B/2 tOPCZ1rvpwjufEZ/cgGAySzV5LwZLXjnL1ufI9YN2VBU7SJ9Q6ClNUzM8JC1GjVZNi0y mBLjZT/laSJgvD8SXRyFsWVA9Fv3Pe3KTRyV8UkMf2kQMr/jXZB8oNKm1VU6LvgUdfXS DI5nWL4jEt3FqMfEKrizdO+4cV1HE44ojOlST5Ga2tM+4VCwfkzvzOBI55nA4q76oYtr P5BUvVIPU1MX4Iob819PiIBLyzF6YoIHXYkAJW+chpZy3IaHXildWaUM4XreVAMknQBm C+gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bvYghq4E44tobiCXSw20DL/ja5986RjMD/NlIgq82uk=; b=kia84fBqlkKHfJs0pGk2r+raURX0K+y5jfUPu91JIzvL/akRySA8aXYvLht0hOWX6p pOETj5WPsm6vaJjTCZ3e89Wfxvymg73pckF6A7RtLadCtzrKH7D15Unh5oVb7zBJM25y fpCrwRdXSEB0+sk6FATFYqQPh7/C1BIf1rAf6CvQyoVmU9jd0snXzb7ZP45qPiFBA7/1 CPev5kaiqEKAQ5Atf7ZHzX8FAhi1EORbdecHuPy+mK9wdJnu6nFVJ2EB2zZ0qCdbirTj yqQaWznUPE1RTYWjBH+d3pbGcFS+FwJNyLTQw+8my6hzYltWe6yA3Vwvz8s1pql6H3IO Wpvw== X-Gm-Message-State: AHPjjUg22ujzXUFyKRrzHObYMiyKJ4uOEbvZIuNkRTMrabrlKsPqKcdy vTvKcUwBo1m3S7uaE9EHTQtaDg== X-Google-Smtp-Source: AOwi7QDcRwp7MMkgULZ6vjiG/zRPcjGJuFsXVJPopiefWVwnXWUHb2tloUuCCB+TmrOoX0Af99/Q0w== X-Received: by 10.98.147.137 with SMTP id r9mr8066934pfk.161.1506061089413; Thu, 21 Sep 2017 23:18:09 -0700 (PDT) Received: from os42.localdomain (ip68-4-115-207.oc.oc.cox.net. [68.4.115.207]) by smtp.gmail.com with ESMTPSA id e87sm5911355pfl.46.2017.09.21.23.18.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 23:18:08 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: Dick Kennedy , James Smart Subject: [PATCH 14/19] lpfc: Fix crash in lpfc_nvme_fcp_io_submit during LIP Date: Thu, 21 Sep 2017 23:17:36 -0700 Message-Id: <20170922061741.12347-15-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170922061741.12347-1-jsmart2021@gmail.com> References: <20170922061741.12347-1-jsmart2021@gmail.com> 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 From: Dick Kennedy The driver is seeing a NULL pointer in lpfc_nvme_fcp_io_submit. This was ultimately due to a transport AER being send on a terminated controller, thus some of the values were not set. In case we're in a system without a corrected transport and in case a race condition occurs where we enter the routine as the teardown is happening in a separate thread, validate the parameters before starting the io. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvme.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index e6948945a2f2..02ba06f364c4 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1235,6 +1235,16 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, vport = lport->vport; phba = vport->phba; + /* Validate pointers. */ + if (!pnvme_lport || !pnvme_rport || !freqpriv) { + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR | LOG_NODE, + "6117 No Send:IO submit ptrs NULL, lport %p, " + "rport %p fcreq_priv %p\n", + pnvme_lport, pnvme_rport, freqpriv); + ret = -ENODEV; + goto out_fail; + } + #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (phba->ktime_on) start = ktime_get_ns();