From mboxrd@z Thu Jan 1 00:00:00 1970 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 154FFCFD2FD for ; Fri, 11 Oct 2024 09:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nFz5xYMdgjMO+xGUIwzNQGrZYLZlh5i78EQTQ2PyucM=; b=PrZgm41PksnOXnSXq/C+gpD3mZ 5AcB17P/dCeCSUH2tY2hz+fQD4oHkFmpuOWWkCFrpCfUeMIkCO/qEAyNW2f9/Z5xGgDqpYhrJn1Eu /N4r5pHVpt1NtrxkfMswS3GgelJxL8L3C/bJWW29Jq+Rhld0lNNlHqfKjbZXkAkMQoImBJYOt4anR pHkvF6TU7FaODRPEAc0vSOyKIYHTsX51tsoM0g6uZsDU3fOby+PlRpc9kCTiHFUXASP3YbvD+c4Rb PeEHA9hRZmr9qSYySyAHMrEbW41rSaJfhJm3v1PZEuT3gsow/AP3k9t3LOkDDcOKyFCR4qtR0OJ0J 63QevO/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szBud-0000000Fpfq-3VRb; Fri, 11 Oct 2024 09:26:19 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szBtH-0000000FpYU-08rm for linux-arm-kernel@lists.infradead.org; Fri, 11 Oct 2024 09:24:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 95DC3A452EF; Fri, 11 Oct 2024 09:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8171FC4CEC3; Fri, 11 Oct 2024 09:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728638694; bh=29JTHK8TtoAbpThuxLfdJOUJ6pvzU1TbMc+KdwGPaZc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tSUwXnvAF8ga5/iEGs4FXVgxQJ9dkQV1S0UKyO+0mi/vWcKqXakdEsU2uC4l3Wt2y AoLojPTX7Y/dJ248yjJOrwGm2dhXCBUofB2zl3F05UXXjtep9yhHc4igBL9ou9II3L ENAeYXotK+wWpj+0o4LDVNUGXtBLPSvS2gS4OJbyFysKmSRcRQe13/yiygB8/4Z6ki 1ehiS6MH9i6PHkKQ5wIO71DziOC535ec49xWJqu3nPp6xGiNETDezTznOsNixdXFQt Nb5MHqvbILWyXIx7oOl/anaBR4WDnFlwzaQp3jzoLVBvBj3I3kLEkO8KjN2yGv+Rxm mjgXL8GBv5cEQ== Date: Fri, 11 Oct 2024 10:24:49 +0100 From: Simon Horman To: Jinjie Ruan Cc: lars.povlsen@microchip.com, Steen.Hegelund@microchip.com, daniel.machon@microchip.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jensemil.schulzostergaard@microchip.com, UNGLinuxDriver@microchip.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test() Message-ID: <20241011092449.GD66815@kernel.org> References: <20241010130231.3151896-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241010130231.3151896-1-ruanjinjie@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_022455_162335_FD31DDD0 X-CRM114-Status: GOOD ( 12.52 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 10, 2024 at 09:02:31PM +0800, Jinjie Ruan wrote: > Commit a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in > kunit test") fixed the use-after-free error, but introduced below > memory leaks by removing necessary vcap_free_rule(), add it to fix it. > > unreferenced object 0xffffff80ca58b700 (size 192): > comm "kunit_try_catch", pid 1215, jiffies 4294898264 > hex dump (first 32 bytes): > 00 12 7a 00 05 00 00 00 0a 00 00 00 64 00 00 00 ..z.........d... > 00 00 00 00 00 00 00 00 00 04 0b cc 80 ff ff ff ................ > backtrace (crc 9c09c3fe): > [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 > [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 > [<0000000040a01b8d>] vcap_alloc_rule+0x3cc/0x9c4 > [<000000003fe86110>] vcap_api_encode_rule_test+0x1ac/0x16b0 > [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac > [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec > [<00000000c5d82c9a>] kthread+0x2e8/0x374 > [<00000000f4287308>] ret_from_fork+0x10/0x20 I guess that the rest of the log could be trimmed from the commit message. But I don't feel strongly about that. Also, it is probably not necessary to repost just because of this, but as a bug fix this patch should be targeted at the net tree and that should be indicated in the subject. [PATCH net] ... ... > Cc: stable@vger.kernel.org > Fixes: a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in kunit test") > Signed-off-by: Jinjie Ruan Reviewed-by: Simon Horman