Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1145210pxv; Fri, 9 Jul 2021 19:26:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylll6c7s3Q34FfjpYlkvH77YcaK8NOCv8cbZg3SQimliJkKEdXNQ46jp+zpcrk8fhoET4Q X-Received: by 2002:a05:6402:26c1:: with SMTP id x1mr50469427edd.261.1625884019324; Fri, 09 Jul 2021 19:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884019; cv=none; d=google.com; s=arc-20160816; b=ifUhO1MbGvViYB3L1NKYJAV7HpTFGjxVRJ9aZuK/yYZBTnVTEx7Z1Xp5uand4NfFP6 e3ALyCkcfE/qjMzWKl91pzPI1yN4ndGeMbWHnyTZdjUBuxbIeCmZCRa6NovlNZdv9Fmj pdDMSPqwXmyvfdTJ+KNDOVhYXUn5PfC6mB9bRvzpfcCYSZig9DH3n5cEFqnKYTj1BYen i0oSZdlG5dG4ELnJQik4btIoR5Qibgt7KFz/GPLsyKm2o+YuOrJoCuHc3/J0DSNCTCNl GL6RTyopUOAo7bL/udsUjIMaEnO8XevNToOnWX+So0xM4XKme+VisvsD0LlXIzjKmYoV Qk0w== 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=BIoswtKDYWBaPO36IA7QJhaUfr6pAShrWmI6pFpJBqY=; b=q8hku8fNSamXAXYgRmaPIbWYTwyv5Orte9JvwrTYRuPP04OFqfZEPcp5ph7nmoW5ms G5d7Gn1S+ia6EDtqCIH8CzsQ6QDyJ2NPU1HIPAoI8zc4kzxDUCaOMjj67946R+ngUoAq b9rFk1/XZg6y5uY/KW+ORz/i/nHgPGKj4GTUK4l213l7TON8ab5lPIbIkG04TY/NUOcP jj1kdq7mjFIQttsdzIdBfLE4Xn7ErTtOImYvMD5YTwaxY019N8ZaKvv2WjFj9y69lsYG KNXgsDeiSRMpNDUDkUc+QXJrYqpineRZ9VdlnspwOfcxg4wUr5t9V2HTTwdy8waOHZeN z4gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="R/4AZz6L"; 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 el22si9161154ejc.540.2021.07.09.19.26.36; Fri, 09 Jul 2021 19:26:59 -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="R/4AZz6L"; 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 S233328AbhGJCZt (ORCPT + 99 others); Fri, 9 Jul 2021 22:25:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233007AbhGJCZR (ORCPT ); Fri, 9 Jul 2021 22:25:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1700C613EC; Sat, 10 Jul 2021 02:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883752; bh=tZLjfOhzYoqZb1o44QvJtfXr2zfgQOLr7OJ0cpy4/JU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/4AZz6LL/qiLo6OJrSVLpxg27SqLYODKvbz2FBIVBvtdZ9W5RolwkDf9fWcOosUR LSAHn4haps9fHDLxJYqnrmCmI4EH99FVHHoZDuUt3KWE8TrFr9AZpn0DWV0uBT4wMt cWo/RyMKQCexWMSuacu2m5nMEryk/ULwdMnBO4N/MgkosakbK2N0q8bolVszJEJg69 L7F10+ZtPW8gC/J1wEoaXFiwvWymUdPc+9nLLjDIbknt9ZNS82EjyqqhahwmKdPhQy 28VL8YF2ClfGCJQK4NIeTqE/Vkk3tbB9gtbQaYLzDlYG8M8Q5vo+fYFhfxRAjtVJRw oVwQ9ahr4pljw== 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 5.12 028/104] scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs Date: Fri, 9 Jul 2021 22:20:40 -0400 Message-Id: <20210710022156.3168825-28-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-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 f8a5a4eb5bce..5b43396815fa 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7962,7 +7962,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); @@ -8128,8 +8128,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