[<prev] [next>] [day] [month] [year] [list]
Message-ID: <02d0999c-af6b-4bc1-846a-7da7f88e3f6a@lunn.ch>
Date: Sat, 30 Aug 2025 04:29:53 +0200
From: Andrew Lunn <andrew@...n.ch>
To: mohammad Hosseini <moahmmad.hosseinii@...il.com>
Cc: nic_swsd@...ltek.com, hkallweit1@...il.com, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] r8169: hardening and stability improvements
On Sat, Aug 30, 2025 at 02:21:18AM +0330, mohammad Hosseini wrote:
> From 40b549f1f955a177729374b73b58ec89d40f37a7 Mon Sep 17 00:00:00 2001
> From: mohammad amin hosseini <moahmmad.hosseinii@...il.com>
> Date: Fri, 29 Aug 2025 21:18:21 +0000
> Subject: [PATCH 1/1] r8169: hardening and stability improvements
>
> This patch improves robustness and reliability of the r8169 driver. The
> changes cover buffer management, interrupt handling, parameter validation,
> and resource cleanup.
>
> While the updates touch multiple areas, they are interdependent parts of a
> cohesive hardening effort. Splitting them would leave intermediate states
> with incomplete validation.
>
> Key changes:
> - Buffer handling: add packet length checks, NUMA-aware fallback allocation,
> descriptor zero-initialization, and memory barriers.
> - Interrupt handling: fix return codes, selective NAPI scheduling, and
> improved SYSErr handling for RTL_GIGA_MAC_VER_52.
> - Parameter validation: stricter RX/TX bounds checking and consistent
> error codes.
> - Resource management: safer workqueue shutdown, proper clock lifecycle,
> WARN_ON for unexpected device states.
> - Logging: use severity-appropriate levels, add rate limiting, and extend
> statistics tracking.
>
> Testing:
> - Kernel builds and module loads without warnings.
> - Runtime tested in QEMU (rtl8139 emulation).
> - Hardware validation requested from community due to lack of local device.
>
> Signed-off-by: Mohammad Amin Hosseini <moahmmad.hosseinii@...il.com>
> ---
> drivers/net/ethernet/realtek/r8169_main.c | 150 ++++++++++++++++++----
> 1 file changed, 123 insertions(+), 27 deletions(-)
>
> rtl8169_private *tp,
> int node = dev_to_node(d);
> dma_addr_t mapping;
> struct page *data;
> + gfp_t gfp_flags = GFP_KERNEL;
>
> - data = alloc_pages_node(node, GFP_KERNEL, get_order(R8169_RX_BUF_SIZE));
> - if (!data)
> - return NULL;
> + /* Use atomic allocation in interrupt/atomic context */
> + if (in_atomic() || irqs_disabled())
> + gfp_flags = GFP_ATOMIC;
> +
> + data = alloc_pages_node(node, gfp_flags, get_order(R8169_RX_BUF_SIZE));
> + if (unlikely(!data)) {
> + /* Try fallback allocation on any node if local node fails */
> + data = alloc_pages(gfp_flags | __GFP_NOWARN, get_order(R8169_RX_BUF_SIZE));
> + if (unlikely(!data)) {
> + if (net_ratelimit())
> + netdev_err(tp->dev, "Failed to allocate RX buffer\n");
> + return NULL;
> + }
As you can see, your patch is whitespace damaged. Please try to use
"get send-email", or "b4 send" to avoid these issues.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists