Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407815rwa; Tue, 23 Aug 2022 04:23:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR41OGKhQWgUWkbzNhoGedeW6f//sMUj5xypsKTokWf/4XQOEabp7VrBT8XE/1L9WIT/XH5u X-Received: by 2002:a63:d047:0:b0:41d:d4e9:e182 with SMTP id s7-20020a63d047000000b0041dd4e9e182mr20245665pgi.328.1661253814179; Tue, 23 Aug 2022 04:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253814; cv=none; d=google.com; s=arc-20160816; b=a+zJQOCq1H8W1jrqbtI4v9/4dM0sQWfAZDNOxAxEJ4z6i7zx85kHwdjx3a4IPHgfaJ iTJOFkrlVye5ps9Z9ghBTNtq1xDZ8sm2PaCVcr9cmqIDB+YZvCMPK5Vx9JwMFL3cxxc8 cMHCh9fvlKdfuV2yF4lbrleTSBdOG/qp8Vs3nB+4P6PULpitUb5mSt1ksMuF8xGavVYd qGhtdLUWkYt+dtQ6DcEVUfcX0v4nyPNEFQ4W2BXyugbP20ns+RAjb6hNpRdD2wiag3+E hLAyBEO0Fk1Yqo3Y5zC9wdvuea5Bxn1fYaly+OzAQcN//Biq47SO1cGVOp8osljD5le6 i8ZA== 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=cnupbhks4ICIBEWai/8SDLuOHPRLlqDmDSbxaHqH4PU=; b=Fpvn4qeBIvv9EcnG2yXMec2OQv/4gf8xhCdwiGFeiP2+7Rl2mu6mUpLiaNvIJG2MBK hGHhVl2EiJTNdJHBY/FHdsZex0pBxF6i3r0x5bfWxHbuazpJ43+c11awVsCJsyjo5qrP jhVFI5cJn01yXdUxDCjtsRtC5Gcu+DLS33SOGaSgqv2QtWk4SrDETsMydMkh1m2Xu+Yc cklEpbyS1Mq5NzJuhUJ93eHV4tQ1M9Mt0Zh8IC6cqZDsx45cNY5kEfAvo5m5aAoB5HZM jppMV13VQsXlEH0+Y284qBRUZmF4uDRIq0ZVk1Mm6M5xXCv6VX+gh8w0ZidOejAZ39Qg QU2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R2oIuUYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l71-20020a63884a000000b0042a0df51028si15093800pgd.797.2022.08.23.04.23.23; Tue, 23 Aug 2022 04:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R2oIuUYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1353888AbiHWK1L (ORCPT + 99 others); Tue, 23 Aug 2022 06:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353865AbiHWKMO (ORCPT ); Tue, 23 Aug 2022 06:12:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB7327CC6; Tue, 23 Aug 2022 01:58:32 -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 5213961524; Tue, 23 Aug 2022 08:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A64AC433D6; Tue, 23 Aug 2022 08:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245111; bh=Ugp6EmnpxCW/jUonBrd4q610od/cbBfW+Rlicj6AB3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2oIuUYz4HimquRkVyliOTiWMk7gSJ9bOXSNt9c/GOScq3KM2aiQq9LE01j/Iw8wC Zehx/ucu35EKy1ekiRiIppSvEcIeIAb5BAFCQBS5poBOGU3r9/dkMtfPoorh6198Ad loB1iU/I4Zn2VSIABo/GfAGwwU5PlP4umJWHXdIM= 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.15 183/244] scsi: lpfc: Fix possible memory leak when failing to issue CMF WQE Date: Tue, 23 Aug 2022 10:25:42 +0200 Message-Id: <20220823080105.446445858@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 fb69416c9623..f594a006d04c 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -2012,10 +2012,12 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total) sync_buf->cmd_flag |= LPFC_IO_CMF; ret_val = 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; -- 2.35.1