Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1151242pxv; Fri, 9 Jul 2021 19:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoDj/2PWh3ObefiIxInAsIZ0fnhg86lKrSuObRsgqzYX2TrfLqcwIojgOW6rVPEtcFKJuW X-Received: by 2002:aa7:d4c2:: with SMTP id t2mr21407874edr.92.1625884772762; Fri, 09 Jul 2021 19:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884772; cv=none; d=google.com; s=arc-20160816; b=nbGgtQo8a7/tkBun9E875ZJWeQf0nyUgL9AVot1eK4SWGE0WgWG4aBDaKGC+O48gzO 59CeI+URaxEcIROceAIXXwH9/weRdMZLO3WszEHhtLB816G3DIa/q/3ZuSZLMNCv1EJR dDDHtP0lgxgzcnBMuxDWbs3ET2fm+kSLQ1IGz4+usWyLapNjB7u4/LnrMDQVple8thed 2/XLpWTfBn2e6JJHmRtibCabSeypPyLOCC6902/0A9WfX8UckGcK/UIWG3BXODyPPe1u +o+Zjm1KwYCb1175Bcq81UYe/dyGCBulovJXxYvIEyypFAsae67ZUZTUReYRcvWksLQy Bo3A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bZEXOdVby1znPLcuIR/NQsOP752LHdltzvcTrCnGsEM=; b=pqLgiz8TZxMI9C/XMq4VV2rhG3dR0DkC945N9FDHBsCezGGUIBRbemT0CVz5Yqp4ck g+nKpzVlN2aK8LARWjpEIRlgHg0xIJPs21XHiFWvdIEVnPJtW4hdJqo60zPscRqclU8V GTf1wWnsEZrAuWGk9Vmi3cN2mbDMot03seK78M1vBgqodTUr0x3M9rQuNg5TgDcCVBVH 6eN/hOuvjBVOuBMxCk09WCY2vSasg88M9S/d2+fz6zI0KJVV1htiZT1jYi4toLItM6Er BSYmYT8oqLo4YFDCAsvt9avjHQKFqBKwMO9ON0uTqMEaQo+US9UOLjdsFe3hmawSs3yg ekwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mjiF5s9s; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si10604506ejr.586.2021.07.09.19.39.10; Fri, 09 Jul 2021 19:39:32 -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=k20201202 header.b=mjiF5s9s; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234270AbhGJCip (ORCPT + 99 others); Fri, 9 Jul 2021 22:38:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:53548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235697AbhGJCe7 (ORCPT ); Fri, 9 Jul 2021 22:34:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A68856140F; Sat, 10 Jul 2021 02:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625884333; bh=LNZ1ijcxAOXZk3ir46ecIESQwnCMYx5b6Fj+uI4mPiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjiF5s9s38krS/hFpfCYiVJuj7d9vfcFbQtG9DRc49MQ1/svyRekCujXG9i/9Ukqq Dv6P250YIrhZYjTLJ3bWr856KwrUORLCMJkjrREoAOgI6/t0W3hdHfM5mOgfWojaWI lSKzfSHBf9yeGqauTyvPfzS/FxstYPdsn5hBBS2d5mnmjn7Dr8k5lTWsczQ7uYxfF+ lXZUo+s6rd1qhW/STO8uLihR3Ds33iYLekvtv7ip6Q9m1718MJJgGhB/c2ZxXOuX31 /vW20YlFn8x+qKmmhvhzQig3JbqmY2o5zdXD+76Bqtif11iNa8S600JdtnuyhgKOag NU/4yCnKDRaOQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Justin Tee , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 07/39] scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs Date: Fri, 9 Jul 2021 22:31:32 -0400 Message-Id: <20210710023204.3171428-7-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710023204.3171428-1-sashal@kernel.org> References: <20210710023204.3171428-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 f4633c9f8183..40d6537e64dd 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7281,7 +7281,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); @@ -7406,8 +7406,9 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) 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