From nobody Thu Dec 18 12:44:49 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25DF0C32772 for ; Tue, 23 Aug 2022 09:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243882AbiHWJMv (ORCPT ); Tue, 23 Aug 2022 05:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348501AbiHWJK2 (ORCPT ); Tue, 23 Aug 2022 05:10:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D2574DEE; Tue, 23 Aug 2022 01:31:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89870614BC; Tue, 23 Aug 2022 08:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 795DFC433D6; Tue, 23 Aug 2022 08:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243463; bh=tOAIb5zAvN93JR+nNiVB/+65aJaN03Crd3NKqy/DKvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0ArgVrC6F7ZwBNeCjSt2fbg2Sew6RhiBLH8ZnzZ7saWG9DN4NCbTc/2tia6IS1t1 JHEZp+IBFGXafZ8UqQr6aGizXmePXQZeDXZ4dOMGAL6vblfOyxuNN/qwn5evOCdKoM GGRV3LEe3hF1l1ziF2q/80ztfTGLapEVvNiupEUg= 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.19 285/365] scsi: lpfc: Fix possible memory leak when failing to issue CMF WQE Date: Tue, 23 Aug 2022 10:03:06 +0200 Message-Id: <20220823080130.108694170@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 2f67dc7970bce3529edce93a0a14234d88b3fcd5 ] There is no corresponding free routine if lpfc_sli4_issue_wqe fails to issue the CMF WQE in lpfc_issue_cmf_sync_wqe. If ret_val is non-zero, then free the iocbq request structure. Link: https://lore.kernel.org/r/20220701211425.2708-6-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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 80ac3a051c19..e2127e85ff32 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -2003,10 +2003,12 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 = ms, u64 total) =20 sync_buf->cmd_flag |=3D LPFC_IO_CMF; ret_val =3D lpfc_sli4_issue_wqe(phba, &phba->sli4_hba.hdwq[0], sync_buf); - if (ret_val) + if (ret_val) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, "6214 Cannot issue CMF_SYNC_WQE: x%x\n", ret_val); + __lpfc_sli_release_iocbq(phba, sync_buf); + } out_unlock: spin_unlock_irqrestore(&phba->hbalock, iflags); return ret_val; --=20 2.35.1