Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3326774rwa; Tue, 23 Aug 2022 02:55:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6TpUDNuPY/6xcQL9j6x71FHkp7HTnqf8QL0x3Cl3zesBZLj9sM6m4m9uwWTijh+efRn2Ap X-Received: by 2002:a17:907:6d24:b0:731:7720:bb9b with SMTP id sa36-20020a1709076d2400b007317720bb9bmr15906618ejc.717.1661248529205; Tue, 23 Aug 2022 02:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248529; cv=none; d=google.com; s=arc-20160816; b=ZBAMTMOlRgj3Qwy4v5oiseGDK9LlokPUaYi8j4HjBZ91dd/VEgvqk+FbSjUKL70aGC 4iiUkzMtP9NMw3JuVFb7Sx5gin0Xa3PsBvRirb0tO1/DHMGHEj9N8oUZn3dP17mGh+L5 DKYNI9erGKoI9InZQ913J7wC53Kvk5KQct4Iw5XxHUdnOXLA1wwm24afbAmk6uOQVcDT lWq7pc8aFjNSJOVqvkdeLmHlVrk9aanbgp+g2UPUlBIWy/hR+ivlZoQOBt1f/1jEG6a3 F9qOYQfzzHRcK7l/gxZ2y0C2FOzCWQRBAxtj9059HiwBA6HA2VfINxi2lusH9Zhj+1IF aSZQ== 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=Du+vhR8UjOp31fRZgDv68oEj9Nw4ud4py0yyUcEu9C0=; b=BHsIONcVqdydveMM935YVJjihqLrIL7MQnPpOJsvr/kpWMLz7Rtr15N1L2ro+K5tki 4tcK4Tj5Q9Crcs74AXMLae0vUyE8xL9TSQ7a/MmrfvBx7X/OVzPtQfmDHsB4Ddkll2vG ZmZyxMn9pwhVNiOUwJfQBWx5dKKrS/nAUCoECw6Fp5yp2b1/zwisdSNjv50MtQBl6ZJh l5OYhQEqkcChyiCuhtSVFVH1xBK17OutTdNCCib46rbR7nAHe3yf933xJB64o9xWaVhf 2c02nzpCYbvGstpIXOGuFmAX56UF9Bno7KwN188K9nlzfYKs/TX7Nj5UL//KGzqNyf92 2LAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i0ArgVrC; 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 b88-20020a509f61000000b0043aa27d303fsi1793757edf.226.2022.08.23.02.55.03; Tue, 23 Aug 2022 02:55:29 -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=i0ArgVrC; 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 S1348402AbiHWJMu (ORCPT + 99 others); Tue, 23 Aug 2022 05:12:50 -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-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 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) 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