Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1646753rwb; Sun, 14 Aug 2022 08:39:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Stg41ngwNrnyOXx0gUIDnsfXqllsgacGHda8sRORQQfykTYy43AOTRR0laf3B88voZYjM X-Received: by 2002:a17:906:4fc6:b0:731:137:8656 with SMTP id i6-20020a1709064fc600b0073101378656mr8063640ejw.582.1660491580589; Sun, 14 Aug 2022 08:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660491580; cv=none; d=google.com; s=arc-20160816; b=ul7DNibFZrRvuwtoj+FeuuADwrio4ZdB6wEVR+NepvxcOhicrALlRcWqUZZygcewpT lWY33WU6hyL1UFouXwgNigCeNtWH5XU85QNRygXQs/06dJBwubQeLN4LAe+zWeUiSIvh +v3r4c2/G7No7on0gvpWfq/b+gZFL/i+SkfIdMGxcFOIWNHn2y70fh890NH592fYFt/4 vln3Ei+zmlvofekmR/rpFkpCUutfxbU83NAm/u+fLZV7i64PBKxtk9PwtofjXMfZ6sng JqPiBqpse69gTANZLQQLLLfgJIdhhpvR68QNds6M4n5tq2NNSnNj8XW/ReytXEJEsbtq /hyQ== 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=Du+vhR8UjOp31fRZgDv68oEj9Nw4ud4py0yyUcEu9C0=; b=sSQEry7F02LsWRoI2Q1AhoTGds7tGZ55EeeSn6oRZVP3PC7/+DVZH8vLjVhY+sxGCO 4KmvJJ7iHL6SZCCJcjLe7zDRS8eimA2h6/95xkFoQHqIepK0ZOvOM0GW1ErCVEOS+V41 PJ79GDe9HZB4dIIGOjwPPt0XEBVBsmbjKUrC0XL9LjIZ5ZgweNwpblHoJH57pa4wXZi5 N/EPk491wcmdqpE/p1TMlx6I+5j262YNbKqds1zKyfxdxE9d6g9TCekMwfV/EGEVRIzO 0x2a17M7b2coT4nCS4nX620w4OJEW+tGnOnUhsRLfKgYBIdmmpFNnLG+jp3VsRS4mdJo Tfsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ej6Gu7Id; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a056402520500b0043cea582924si6929760edd.54.2022.08.14.08.39.13; Sun, 14 Aug 2022 08:39:40 -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=@kernel.org header.s=k20201202 header.b=Ej6Gu7Id; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240370AbiHNPaT (ORCPT + 99 others); Sun, 14 Aug 2022 11:30:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiHNP2x (ORCPT ); Sun, 14 Aug 2022 11:28:53 -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 F2820B1CE; Sun, 14 Aug 2022 08:28:52 -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 8FCB260C13; Sun, 14 Aug 2022 15:28:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9238C43470; Sun, 14 Aug 2022 15:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490932; bh=tOAIb5zAvN93JR+nNiVB/+65aJaN03Crd3NKqy/DKvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ej6Gu7Ide6noXPg5kVzm4+BAUKy2eqES+wlWLcVtCowgLJzlsMcE4ccqnQjCZZqVr /1ezB9L05Vfk0+bigSqRUSF2NgwUFzPREEZRm+N9OsKRrNRwa8vQTpsjtRjoKcwTR/ JPkbfzO6wOdFSwWk10On5dCmsiNbi4pdAUfKf78hQxsD9nhuJCEfQfOMPQhoPGoa7H YfQG1ix8xMTVI+UZAN18MtWYSG4qEHqd95+j2LBjBDMANWiE+JVUwlZBq61hTSP/YE pD6g4p1bBHqc8NqhxqDlI+ezVEwwJePxWTRL+NqBagwI/34JiAaN4vxjHx5ybV6WEq xsJafB6hHsl2Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Justin Tee , "Martin K . Petersen" , Sasha Levin , james.smart@broadcom.com, dick.kennedy@broadcom.com, jejb@linux.ibm.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 30/64] scsi: lpfc: Fix possible memory leak when failing to issue CMF WQE Date: Sun, 14 Aug 2022 11:24:03 -0400 Message-Id: <20220814152437.2374207-30-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 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