Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3353208rwa; Tue, 23 Aug 2022 03:25:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR65KWwf+j/mX2K1MAj5meOtrXzOk80xd9iuNEzrjKQ6/gevW0V0HiSXNJBCArwtooqyRWkF X-Received: by 2002:aa7:d682:0:b0:446:c5e1:f91 with SMTP id d2-20020aa7d682000000b00446c5e10f91mr3111585edr.26.1661250306327; Tue, 23 Aug 2022 03:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661250306; cv=none; d=google.com; s=arc-20160816; b=RtLgijfMjuFKi6zBOjTF/ol+uxb5xXNHx/bmZCkmFuV5vL8qesl0s6ahE/ZS+zUB/t wwc3YcqBcyRNVkVX2CTK/jb+2debAa2Q7q31LwZtoEBeUoEyGBCBIFy04WMOAodIvNGa KhpAQlIGiHPBqVZtNucO/oBECI6v4jr2+O7UFWrQ57OgNaUx/1SkFwBEvg3AJ6jPiIxa FXKqJoFlXHk4RFbsla1Om9h/pCTf/N/qe07BmKMRKFuhmRk35qcZ2XNCsg7RTUFjinYR +5c++7BUq052m9xBmxZWJsozZGygrDO1WIc6SWH17PhDxaG/E3d7FROFXJCeJNkMnRHk wN9w== 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=zgSqYWsa766QtxhZ2IF4vyo+gvi2J2Hx4Sc4cAp1OiY=; b=Du4G0Urk/sWnwk1BnOZ1K2W74284KzGIAz8XstQEv/zENhTvaRtrV+IJL+70Vo4tHX 04nbecK2yZHaaJrplNtO3ijr7V6eixB+s9/9UvvPpghYlSmmyJVp7w0g3rVA774vmMTC WMlHr2OaVKb0ly1kqBn33cxJn68wvJCqOQpyxrHS6zH6N14M20xKIQ6fOV3fbZ/CUJZm ELD60w+hiYkk/XrASZu2EDsPEgLu/9ozcTqWRb+teryTh1yYgpQUW4g9pMNP3CXYF0qi 0qBMaAP5WT6JHSCND+WI+m1V6hCF+85UsiVBtRXG+ZTSGHXK/Q0Ok+NEioHKLznlqfL3 eVcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QZz3L2AX; 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 t18-20020a056402525200b004405af7da47si1951027edd.564.2022.08.23.03.24.40; Tue, 23 Aug 2022 03:25:06 -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=QZz3L2AX; 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 S1354715AbiHWKWG (ORCPT + 99 others); Tue, 23 Aug 2022 06:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352946AbiHWKJn (ORCPT ); Tue, 23 Aug 2022 06:09:43 -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 0CC1D7DF6E; Tue, 23 Aug 2022 01:55:55 -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 9D1F661561; Tue, 23 Aug 2022 08:55:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACB8C433D6; Tue, 23 Aug 2022 08:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244954; bh=BvpZ9+z3PwhwVDxWUyHfXYsBLSq0+ghAeah0uQ9gcoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZz3L2AXR5uqp2lmp8A1BjhdVOo5Ea+9FxF1T5HLg2p2/AxRuabHRPMtgINeQTZvv a0i42epi0iGVMAXbawrtdzRwIVbndISkZlYHuogg2XrzGxpSUMwS4zmvyQVmVEset0 wNrgIf5d8icfXdApSBooDk4r9Rm4bD9dlxL9ml8Y= 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 4.14 217/229] cxl: Fix a memory leak in an error handling path Date: Tue, 23 Aug 2022 10:26:18 +0200 Message-Id: <20220823080101.396665634@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 ce08a9f22308..0dbe78383f8f 100644 --- a/drivers/misc/cxl/irq.c +++ b/drivers/misc/cxl/irq.c @@ -353,6 +353,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