Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1147161pxv; Fri, 9 Jul 2021 19:30:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUi5OjwdwkTck8px9TWvAe1QoH86kXFHdg0KnwHvISeEKc9+zACkAWXmet0wa5XC0qxd7w X-Received: by 2002:a05:6402:1a38:: with SMTP id be24mr10560988edb.58.1625884253719; Fri, 09 Jul 2021 19:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884253; cv=none; d=google.com; s=arc-20160816; b=hhFDMH0MX4rFGRpdSH1vKY5g4cmGDRMKcIoOpKFQVfiVTJuQcQ/5FU/SsHm1rnWHAk wIAs3IpxwTROJsMElKt+WVkXfROVPqv/5p9pJPNS7gSoQ/Gdir2PcNpq6ks4oHc7a3MU o2vjetRNAqmKNDIRFaMXDGaCja3Qw5veqGPTHOGQ5B9ip9FwrXf8RkrUJ1woOB8DKsn2 zK+cOxLVmyS3sFffbz/uN1BreC/UJ7Ks/MXV9hrgVCf240DP++9rwR9WAGg4DtJANXY6 WHauTJ3Io4v03ZkVoSK1slypP+L0MqLq0+R25U2bRDeOk6lFHFJgRSJ+sGKm2f+Fbp+9 6X1w== 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=FmV/tXu45GuqfPQGi470tlw/6if6ScvMKWmslILwJ34=; b=BAT820U3PdBoeFcFZ+WdQDuTgOBUxxArtA8FdauGdJd4OQJRvghYY6PeE2o5WBoc+Z N0O7hi0usk6r8io+GZflDCYaDOBsgrh3GiGUZTekqHjIAI2BF71MWqe1xpuQtNX+Rqm8 uZFgXCtXFJMmQ+N0lfuU58nX+XjcLuG0fizZMys7gqgu2OAB0yVb67Oyv5wEECacPXVW VkHthskHCzflsnOmTtPcV1E5MIvYUf3ZlFGUl1DR2XdnBxM8Upb6dxu30/Z1CNci+/pw EAIIxBK1ZMOrNy23UPWxGO09D8qlaWB1VdkmSo++XPXsQ/rpauxjr1B+GQciC0rMEQEZ /FRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Emrz5OwF; 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 q18si10831292edi.368.2021.07.09.19.30.30; Fri, 09 Jul 2021 19:30:53 -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=Emrz5OwF; 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 S234320AbhGJCbQ (ORCPT + 99 others); Fri, 9 Jul 2021 22:31:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:43180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233996AbhGJC2K (ORCPT ); Fri, 9 Jul 2021 22:28:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB46B61400; Sat, 10 Jul 2021 02:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883903; bh=Kr0xudVvbrwiz2B7bAj/y6fZJUNZ7Ay/QCc3GFot3sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Emrz5OwFRY1SjZ7F6Z+QdegdlWkRiZiGjCqo4D6mfeqaHm73YsuIcR0m/iRVzW0nY C+04xWlt62fzTvuRAtcbkZj6CYBER68i8ebdUSsAYI+lICKf6bvwfQIR06w9+VQzDp 4a6G8zlGrZ9/wIEE/OZdF2E6k9fzJAjgvaa1A9eF5VQYfJPz3NMjo6xtITHa86SJhA 5eJaNF3rfTrVNEwTR5MpKY+60ed4dz2eZRNO8OsuXUV6eVEh2kV9UsZrwpHOS+35Ue Ro4rqdImEHFDprXacFXfjwC89YcIxYX0XcHzb7PX0DxWv81pGPg6V/0YIrL+p5qhFz iMNGAHnzTGvTQ== 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.10 26/93] scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs Date: Fri, 9 Jul 2021 22:23:20 -0400 Message-Id: <20210710022428.3169839-26-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-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 bf171ef61abd..990b700de689 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7825,7 +7825,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); @@ -7991,8 +7991,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