Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1645987rwb; Sun, 14 Aug 2022 08:38:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RX6lLWEiOUFocYFnYeXIHnyKHypoaolHkU0I1diZiiRWysid8AAFJTnmCjpeMNC+1Yd4w X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr8112109ejb.426.1660491506660; Sun, 14 Aug 2022 08:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660491506; cv=none; d=google.com; s=arc-20160816; b=Org4olcKCZEcfC8iZsfwd6iRoTWtTS5moO0nmcN+roHW51wFmzF88zHBZigl6BuHEq 8GEIRiioSW1zQAq+U+YHssM9+ojihkRkNTy8MnnbOZfqYQBDgkqZ1pthmLGdscK65DT+ MSNs9Rj3jJX8FbDVBmMHQOQDcYl+iJX01NN1wjJ5VWLZTAKv0TxrlOR8fxAN4XvtyNBN x2aX3Up2TpDrltquOdp9XETD3m0AXr//EsKtWC8ILmV+wBaUXJi3VebwQyD7T8+MrHtV tLgrwjQFiFh+tvWsuJtawyKX1Jve0v0n7hZnuX4WCKEpwwhtSU03zcbMwEiIBiwL0fdS y5Zw== 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=DpN1O3mZUSG0IbH6K0/I5SHUJcfd3QaFMx9g0hN6Psg=; b=Q0A7VwmxrFaYIbe/gE9yEj3pYjuBPy1+sM49wTota+iK4TFWjZ0OuXD3Sq+i9mJA4o y1yDWqR44qAdtg6C5vvu4uBTZ7Z2bTRs9f53RErdAP5plWQn3O76y0C48J0YoRLOyaSj yIfSDp4VduwcDMc34Q5y9UWEcRUa2363EW/2PrGT8jeN3q9I47I7QGr9vJvYrIudLk7R fyqXYuRYBPuC80712UKdN+m0k5QJOZE1fikesr9KM7X2joS6nD9UJR/8pTnSqA04OHlE R6OmU6Jw7MkP09l3aKeRZqquleXuMbdDcEgCEwm+48udzheS3nGRf3GkCCjdGaVeF9Pv 9WIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TcuBzZgQ; 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 hp10-20020a1709073e0a00b0073040248a76si5725970ejc.700.2022.08.14.08.38.01; Sun, 14 Aug 2022 08:38:26 -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=TcuBzZgQ; 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 S240357AbiHNPbs (ORCPT + 99 others); Sun, 14 Aug 2022 11:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240428AbiHNPbB (ORCPT ); Sun, 14 Aug 2022 11:31:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E8341AD8B; Sun, 14 Aug 2022 08:29:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 875EFB80B79; Sun, 14 Aug 2022 15:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E28DC4347C; Sun, 14 Aug 2022 15:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490974; bh=bvxl4NfAPWoJeKXPXZQ9lKtZkp/R6dPMZbid1WSJKj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcuBzZgQJMQRjqen04b+Zvl30DhDkZWkpSYnckaZvI6GeewXM+zDeSUiTIkkZHzHa kS5UBoJ+3idMq19F4IZYeSZQdz8IWA+QT3xGNFBB0k1f3Yt/3o1aepqEmHU1CD1MX8 I9FoZl9sjFL9tFW2A4FtQc06Jx90PYrLym0xPOJbkXA1BqxUTWTKEedBYDALl6G54S HU0vGzvZRmy3DEyjVFEts2UZgWXTqoMMpmUone5CKxOjBynhD/IMHhBOUd/lVPhtlk rnut/UW8iOIYijULEZi7T1rmEOJTU6tDLYZONij8zee5bapTlSQ+tczvRnsmk4kke/ Yt7tyEwBUjE1Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Andrew Donnellan , Greg Kroah-Hartman , Sasha Levin , fbarrat@linux.ibm.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.19 40/64] cxl: Fix a memory leak in an error handling path Date: Sun, 14 Aug 2022 11:24:13 -0400 Message-Id: <20220814152437.2374207-40-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: 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 5f0e2dcebb34..ac3795a7e1f6 100644 --- a/drivers/misc/cxl/irq.c +++ b/drivers/misc/cxl/irq.c @@ -350,6 +350,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