Article View: linux.kernel.netdev
Article #10207Re: [PATCH v3 net 2/4] net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path
From: netdev-bot+sashiko
Date: Tue, 03 Nov 2026 10:18
Date: Tue, 03 Nov 2026 10:18
53 lines
9873 bytes
9873 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message says the new cleanup in
hns3_alloc_ring_memory()โฆ
--
net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path
When hns3_alloc_ring_buffers() fails for an RX ring, the out_with_desc
error path in hns3_alloc_ring_memory() frees the descriptor ring. It does
not destroy the page_pool that hns3_alloc_page_pool() just created. This
patch adds a guarded page_pool_destroy() to that error path.
> Add page_pool_destroy() to the out_with_desc error path, guarded by
> a NULL check, mirroring the cleanup done in hns3_free_ring_memory().
[Severity: Low]
This isn't a bug, but is hns3_free_ring_memory() the right name here? I
can't find a function with that name under
drivers/net/ethernet/hisilicon/hns3/.
The only other RX page_pool_destroy() is in hns3_fini_ring(). That function
calls hns3_free_desc() first and destroys the pool last:
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c:hns3_fini_ring() {
hns3_free_desc(ring);
devm_kfree(ring_to_dev(ring), ring->desc_cb);
...
if (!HNAE3_IS_TX_RING(ring) && ring->page_pool) {
page_pool_destroy(ring->page_pool);
ring->page_pool = NULL;
}
}
The new out_with_desc path does it in the opposite order. It destroys the
pool and sets ring->page_pool to NULL, then calls hns3_free_desc().
That order looks harmless today. By the time hns3_alloc_ring_buffers()
returns an error, it has already detached every buffer it attached. Each
desc_cb[i].dma is zero, so hns3_free_buffer_detach() returns early and
never hands a page back to the NULL pool.
Could the commit message name hns3_fini_ring() instead? It could also drop
the word "mirroring", since the order differs.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261030095633.377289-1-shaojijie%40huawei.com
Technical Details
Message-ID:
<179370110712.488856.17112299707405359724@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355410-linux-kernel-netdev=dewy.ruReferences:
<20261030095633.377289-3-shaojijie@huawei.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355410-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v3 net 2/4] net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path Date: Tue, 03 Nov 2026 10:18:27 +0000 Organization: Usenet Network Message-ID: <179370110712.488856.17112299707405359724@kernel.org> References: <20261030095633.377289-3-shaojijie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3143021"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mSW2RbEgEQAvA28WaFpWP/jjTaE= sha256:rC89BcE4JCoZAc/MMY+Qjkg2flzIXqsBEoAXyIphrLM= sha1:Il9I0VEUsZ5rVKIXKDqp50zotDQ= sha256:hhUr8kSM23aPIB0szsjahfoCs8Z3fNEb01DLn1Mgzek= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id EAAD91127EB; Tue, 3 Nov 2026 13:34:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ALRzbQX5kvEr; Tue, 3 Nov 2026 13:34:30 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355410-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id A00C11127DD; Tue, 3 Nov 2026 13:34:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 2A77E60C2F7; Tue, 3 Nov 2026 10:23:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793701119; b=fVSsc1+imioRIEmF1Ny0cvaPDnihXjG61KJGww5zPMvbayZ4ygrX7jtBmuJFoDuTCgpX sAw1j0bsKeKhWRI31LmGxgR9XKZRKf4QomRddxq2ANjgkIbX51MdurafglktvQ0C3FG0u s/NfvmLu8PJKtMjATjr3QqMeOYVLVxSSJDKqASI0pC22opXhm6NLSrNIIdWsK+xMUbEim AKFKsMlCB8MHrphO8zkCEi/tmjTb9789TxicZpeNRrzIzXWY/PoS2LHG0oJrI98hHIwcY krvEgswwB0njZl6hhSDr/u6ZLohsH2efhQ6aBfryydaugS+2GL9j9OnxGHElUV78fbw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793701119; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=UxgM8P2HIxypNQyiwe8DVm3Lb91bk//Dpc4QBTFjK+c=; b=akTA3i6479+Koed4n9QgFDxOZQsJwMgFecaWUIQPGIfbZg03oLbIrdRH0Gt9G/rnsxX/ D2ywm5DicM5tK0V97iNkZpeUouxeYd1Jo6t8kbSFcRAIueOkwkKqAxiTjQCqlr5BipFvA PNkEa5zeqhvrl8mFuInInOpG+e6dGgo0EoDmocaU+T8nuKK5n/AZrttpgWKLJu2xLq6Eb nBcZf+mHxsqelKQCMEk0xfQaERqtShPyn+k70mo6IYNjvf+rodVQaqYOr33leCv0y9Wrx IUaIyKxvaP8jLcsXaKc0O7pB2VsUh4gt1ylrJDcP3eodnUxxm0bt4/NbU8MhJ9tmf+A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ya3uMW4w; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC0E56083614; Tue, 3 Nov 2026 10:18:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ya3uMW4w X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793701108; b=40oIPioN9vumHNOHuFJI+ObVKTLlGVN6B4xlJqPViULchfhVCPbvFiySbaSX5KG5VpRk pAuSCTTg4ulzUIx4fS600nv5Yo0zezROuh7fnXcDwkzzSf5J9e+rLxtTJddz7LkuvY2mq 0WoAiYhG8UKwLeO1Zk9QSR6JYoME1qpGs10Kcs4GjddDocv6hXJR0pdGU1HptlzhVraHb NceaLff3/5oXZ+BY6elVLRjPIabiHza3wdMT2sx89o6iPXjsrSxSLRTGq1zoMeFHHDLq6 GLFB7FqbeboEO1uuo/B7+XD3A61iUnySPDVN1iW/LIrbf5jKAAmLHUxtz7tCTdUTn6A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793701108; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=UxgM8P2HIxypNQyiwe8DVm3Lb91bk//Dpc4QBTFjK+c=; b=VRBHQ4MO2PZot4igWdqZ3uGWRajJaYDroE7HR/TSfcFaOQWQrVnUBLc2YMfFiLHXmG4V ItxglZIXzKwuaPIhUqRxqgVBz5TSRYfBE/K/FQxWNlccDKWmBxW15tdv0umGCPNTZ8x0k TjlORFgDUnhCFdex64okcHcxb/V1v9FoxsNdYszkkenng5WhKl57bYcSghXGRy1/y5tyy yABilBf+ozF7+7z0nvAsd3xR/K3/bqHCbnR9zuxg3nrB0oDh/uVNwOOmgbQbC8Zb2EHti zG7iUVUnYNxJlTBeDXSuAsrjEb/JXNOIsdp6uSBLS/Nnow2g2oXUJ4399oCHMuAOjbA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ya3uMW4w; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 862B96082BCE; Tue, 3 Nov 2026 10:18:28 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 904CC1F00A02; Tue, 3 Nov 2026 10:18:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793701108; bh=UxgM8P2HIxypNQyiwe8DVm3Lb91bk//Dpc4QBTFjK+c=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Ya3uMW4wDXlXMFg/bXBytmGLOGr/sIri79M9Z/a9eG+aP60Qr2yze9HgFkw5rsk2E 0XNq2Evz3DaZte2ivb8FwKeV12TJT9MlDuKRtKDGmxTGVwjlcpux5VngKErNbMhwD1 +ebsNrJybTD0vs3WdBVEs8F+udovpCkq6Zz1upDiwtT3cE5If7k8K3mcieSRTYZ8lR tEjqjI+klT1u10ZAFvIubCLIifpDDTc05rJxbYa8f2Eic23efBWQbwy9oYWamFxC2N m3nbAMD2SFt2+US/DNp42jHSVNg3aqL5J2x1XRZmxkVFlQoT21W9Nj1ld/KGDnu4q1 yuQ2FLM8k8jjA== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, shenjian15@huawei.com, liuyonglong@huawei.com, chenhao418@huawei.com, yangshuaisong@h-partners.com, ningwei15@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261030095633.377289-3-shaojijie@huawei.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list