Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3832859pxv; Mon, 19 Jul 2021 09:48:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7HE5z4x/SVUFPw4Z/xENVzunmCxMsRzlkaP6cysZK7q9qvT+GNTQ6KLEW0P5tac3ELLHP X-Received: by 2002:aa7:c58e:: with SMTP id g14mr36546521edq.210.1626713334543; Mon, 19 Jul 2021 09:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626713334; cv=none; d=google.com; s=arc-20160816; b=b3LIuI+lnyqMXbIpK4i2MsDxdWwczPksBVtvPJ3uwbH4VRSdkGT2T+DV92Jp4Dzi3B XWZLxdonfVafpasNZ1i2iTv8qTF6PSLKTsx6kx46WXpQuDZc5Y8KLqLbF3+9q1UNcqCi odbIC6wBcryquP8RvkhTICYHq2ZKFUDvZbm8ZelgbNp18s7hQXTlHmGr3MixN93RbSyA VWJW6dvcCNIrE9S/aIo+Bz5sn6MRp8C4bW1LLO/Eo6Wpon16pWyyiumUl+lMl7+wYS8L nF/UxPLIBUzGKAd9/u8nsvIO5cNfIdhPuJ3N4KDUuZOaJuOTd+rNK+KpuA4TYD7w+Xr7 +f+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wSUryOY+22cLVwPsOdmYVWXGJztgRJt6ByqwvGi0zd0=; b=IJ4TelZIbswAbbi+A0eg920xcQqvi44o/coREVDzQwLEh1uDDHPF+Cwg7iQN0vuPPq HShRHf8fBZzmsq82xsQcJ4zCVhnQkx91EOOCZ4Mc0LxcLpn5xuhA5lc/OD64luMDydB8 qIGiBzVILY3EECugGLp3WYB6gUvS5R8IOcKjRzOKr+a/K+JbyeOxUJ7iDon1pT3DNlc+ fm7OLCPfyMJI86iS2lR0DaiDiN38D14BfKnaoSfMlqciqVpT6wSj2jpChgqrrO5Kn/7j LWLK8osEVAi3HO/hWyEAa3idt8v/dPzBy4mgyHzuk9ymr7uVmpBORXcqNBPIu6yPPXF8 k//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EeuxCuiQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si19978120eju.12.2021.07.19.09.48.32; Mon, 19 Jul 2021 09:48:54 -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=@linuxfoundation.org header.s=korg header.b=EeuxCuiQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237896AbhGSQGz (ORCPT + 99 others); Mon, 19 Jul 2021 12:06:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:39496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344688AbhGSPGh (ORCPT ); Mon, 19 Jul 2021 11:06:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EA6160238; Mon, 19 Jul 2021 15:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626709636; bh=OxTA+F8xU/iIV8rt7vCj/gMYjbzh+sko4L705oVrLds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeuxCuiQoTql2B0bnIwrW5WVrn4iLdSX3Pyex1TUVWkBsLRKh+fbUvZ7GeWRVo0YI 0YIy4cXecEPXCpxIF6oPzgnpRJJs/aSatUm5TCp0r1PfhtYrWPoDMymJ+9h441n9tS YidDltJCEBrGVWTAUnFmVC+Ww/ijihZkeDfCTpKs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 021/149] scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs Date: Mon, 19 Jul 2021 16:52:09 +0200 Message-Id: <20210719144906.486615520@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144901.370365147@linuxfoundation.org> References: <20210719144901.370365147@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 5aa615d195f1e142c662cb2253f057c9baec7531 ] The driver is encountering a crash in lpfc_free_iocb_list() while performing initial attachment. Code review found this to be an errant failure path that was taken, jumping to a tag that then referenced structures that were uninitialized. Fix the failure path. Link: https://lore.kernel.org/r/20210514195559.119853-9-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_sli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 795460eda6a5..4a7ceaa34341 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7602,7 +7602,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) "0393 Error %d during rpi post operation\n", rc); rc = -ENODEV; - goto out_destroy_queue; + goto out_free_iocblist; } lpfc_sli4_node_prep(phba); @@ -7765,8 +7765,9 @@ out_io_buff_free: out_unset_queue: /* Unset all the queues set up in this routine when error out */ lpfc_sli4_queue_unset(phba); -out_destroy_queue: +out_free_iocblist: lpfc_free_iocb_list(phba); +out_destroy_queue: lpfc_sli4_queue_destroy(phba); out_stop_timers: lpfc_stop_hba_timers(phba); -- 2.30.2