Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3355231rwa; Tue, 23 Aug 2022 03:27:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR61FCeiAcewpUfD6NS24WZ2w+RFKsR6caTFUJp5DxNEGdqRgph38Nky37UnE6171hrj5wM9 X-Received: by 2002:a05:6402:530d:b0:446:e22:cca2 with SMTP id eo13-20020a056402530d00b004460e22cca2mr2952655edb.237.1661250453947; Tue, 23 Aug 2022 03:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661250453; cv=none; d=google.com; s=arc-20160816; b=nijbg7g6Jaey4yI1455Xck+7eC77t9Ouc0vExGkLXT0znDjPXCS6wKpzJ6AE9lK9ii 1B0I+9U8IY4K5QbvaoTB8CBVo4082nM4zReNs7SqptjYvGk83kLa7Rbq1dNKPNeRzW4b 8KibMQkJ0vLqfkfYtmIdf0IOWJdc6GCCO/4gzHLTmczxgc1+V7aiVMXP9fFxoyqMutS+ u1jfuk37nw4sjaceklupCTxsneOdxfURpV5U54VfQwF8/D7p3mExxmWoFxq/9znk2Eik lY+WJURh3BaXM5wbMHGCJAEHaMUIvNIw9DrDnd5kJBErG3nsgX/tEz+s5SLLYyxL7WQl YliA== 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=7Q18edyhBH0D8q26O7L11GG8y10UmIsyqC1G8DDtL7w=; b=NQPP/lf+TmUlhhK9aiVkqlvEhGDBDitsbYHLMmTWLxzx2Dts6eJ43TDMwR94+MngM/ EWQd1H1uZToCSTm/s40RpbFxphL2YSGH6emWLnTrHfR37xX4FArQQa94LCC40edZKMJP bUbJvCOiTAOvLtxcGjcZMFmrpy7fcFDKnuLDYjOocImMe6+/wHRRdUCizBiXzfSom9Z6 vA/SyMkIhIjIEgMBtZR94YrEWyIwnmUvd2pvXVaV7+nPHflS7GHTv9/N6RbfFrygWSeC GOmLAmlN1OBDdakY+113+ltqYy/H8rCKTx+KluFCUQlLHlNxavqtQr0OLgzRh/L3tg+S q3Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oN78Vk7V; 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 g8-20020a056402090800b004461a2cbb05si1621709edz.394.2022.08.23.03.27.03; Tue, 23 Aug 2022 03:27:33 -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=oN78Vk7V; 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 S1353872AbiHWKYB (ORCPT + 99 others); Tue, 23 Aug 2022 06:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353525AbiHWKLg (ORCPT ); Tue, 23 Aug 2022 06:11:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB7F181; Tue, 23 Aug 2022 01:57: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 86917614E7; Tue, 23 Aug 2022 08:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8150EC433D6; Tue, 23 Aug 2022 08:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245022; bh=g97XD/pgPbqJ4VwO4uV+VBUuGwCDEvgLc1WAUiTfTeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oN78Vk7V/X4/hkFZfDC8h68Wyi3dRWLNpzxs30yv76rQ902AR2AwjcQ3mx/R1BU/b Dtc+HZ7Xj6iFAoJ/pTsgjedxquunV/FUmwjGlBxyN5gEcNE/3Tx6Awritqx8bePKZY en93TjYxII9rzL1ShQEKHlX6L3KGl0rYR2Q+OfFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Donnellan , Christophe JAILLET , Sasha Levin Subject: [PATCH 5.15 190/244] cxl: Fix a memory leak in an error handling path Date: Tue, 23 Aug 2022 10:25:49 +0200 Message-Id: <20220823080105.724420103@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: Christophe JAILLET [ Upstream commit 3a15b45b5454da862376b5d69a4967f5c6fa1368 ] A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the error handling path of afu_allocate_irqs(). Acked-by: Andrew Donnellan Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/ce5869418f5838187946eb6b11a52715a93ece3d.1657566849.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/cxl/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c index 4cb829d5d873..2e4dcfebf19a 100644 --- a/drivers/misc/cxl/irq.c +++ b/drivers/misc/cxl/irq.c @@ -349,6 +349,7 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 count) out: cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); + bitmap_free(ctx->irq_bitmap); afu_irq_name_free(ctx); return -ENOMEM; } -- 2.35.1