Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67D5CC05052 for ; Fri, 18 Aug 2023 11:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZV9QyimMFlKbwTmr19gyK3YOANBEKG7ZqHrARlyOtZw=; b=QAb5Mhw0vvGGA6 uMnviUvooefpHBvxwEvgvTosgbi8caJT+fB+R6oP7TB0RDWmfdRPgoampw3rg/2PXBBjl+lSUfQ7U K/5WrfwyK9cl23EuwA88EtWhWmDTEDh52Ef6tmg3m7B2QLulf0E3QnXjLJi9Uot6aHazPjJDp5cLc oN0/qYPRAwCYBlK12BgfM2wXeKVEylnFQAqb8BDDrE1QOjMCRKUw/WW2EGsCmFdTmMwbAo9lDMOl7 YD1Z3wgReHuTM/eEOMtB1EQ06ojkiRgdCApPAhfQb/l+upqFnhp7eHiJJYizbd0opZpXRoiKRIr+N +IyuuHFPWydJJdoTZjQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWxsB-008pJ5-0i; Fri, 18 Aug 2023 11:42:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWxs7-008pGk-2h for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 11:42:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08DA1D75; Fri, 18 Aug 2023 04:43:11 -0700 (PDT) Received: from [10.57.4.78] (unknown [10.57.4.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2BFEE3F762; Fri, 18 Aug 2023 04:42:29 -0700 (PDT) Message-ID: Date: Fri, 18 Aug 2023 12:42:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 1/2] coresight: Fix memory leak in acpi_buffer->pointer To: James Clark , Junhao He , mike.leach@linaro.org, leo.yan@linaro.org Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, jonathan.cameron@huawei.com, yangyicong@huawei.com, prime.zeng@hisilicon.com References: <20230817085937.55590-1-hejunhao3@huawei.com> <20230817085937.55590-2-hejunhao3@huawei.com> <1d38e877-35ed-5f70-e51f-ea875deab903@arm.com> From: Suzuki K Poulose In-Reply-To: <1d38e877-35ed-5f70-e51f-ea875deab903@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_044231_949478_CF1A8DC4 X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/08/2023 15:03, James Clark wrote: > > > On 17/08/2023 09:59, Junhao He wrote: >> There are memory leaks reported by kmemleak: >> ... >> unreferenced object 0xffff00213c141000 (size 1024): >> comm "systemd-udevd", pid 2123, jiffies 4294909467 (age 6062.160s) >> hex dump (first 32 bytes): >> 04 00 00 00 02 00 00 00 18 10 14 3c 21 00 ff ff ...........> 00 00 00 00 00 00 00 00 03 00 00 00 10 00 00 00 ................ >> backtrace: >> [<000000004b7c9001>] __kmem_cache_alloc_node+0x2f8/0x348 >> [<00000000b0fc7ceb>] __kmalloc+0x58/0x108 >> [<0000000064ff4695>] acpi_os_allocate+0x2c/0x68 >> [<000000007d57d116>] acpi_ut_initialize_buffer+0x54/0xe0 >> [<0000000024583908>] acpi_evaluate_object+0x388/0x438 >> [<0000000017b2e72b>] acpi_evaluate_object_typed+0xe8/0x240 >> [<000000005df0eac2>] coresight_get_platform_data+0x1b4/0x988 [coresight] >> ... >> >> The ACPI buffer memory (buf.pointer) should be freed. But the buffer >> is also used after returning from acpi_get_dsd_graph(). >> Move the temporary variables buf to acpi_coresight_parse_graph(), >> and free it before the function return to prevent memory leak. >> >> Fixes: 76ffa5ab5b79 ("coresight: Support for ACPI bindings") >> Signed-off-by: Junhao He > > I confirmed that the error gone. Thanks for the fix. > > Reviewed-by: James Clark Queued: https://git.kernel.org/coresight/c/1a9e02673e25 Thanks! Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel