Re: [PATCH net] net: dlink: use dev_kfree_skb_any instead of dev_kfree_skb

From: Yeounsu Moon
Date: Fri Oct 03 2025 - 06:51:41 EST


On Fri Oct 3, 2025 at 5:17 PM KST, Simon Horman wrote:
> On Fri, Oct 03, 2025 at 11:23:00AM +0900, Yeounsu Moon wrote:
>> Replace `dev_kfree_skb()` with `dev_kfree_skb_any()` in `start_xmit()`
>> which can be called from hard irq context (netpoll) and from other
>> contexts.
>>
>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>> Signed-off-by: Yeounsu Moon <yyyynoom@xxxxxxxxx>
>> Tested-on: D-Link DGE-550T Rev-A3
>
> Hi,
Hello, Simon!
>
> I am curious to know why this problem has come up now.
This came up because I have the hardware and recently dug into the code.
Until then, it was not considered an issue, because nobody raised it as
such.
> Or more to the point, why it has not come up since the cited commit
> was made, 20 years ago.
I think there are two combined reasons why it has not surfaced for two
decades:
1. very few people actually had this device/driver in use.
2. The problem is difficult to reproduce: one must use `netpoll`, and at
the same time the `link_speed` must drop to zero.
>
> I am also curious to know how the problem was found.
> By inspection? Through testing? Other?
While looking at the `dl2k.c` code, I noticed that its logic calls
either `dev_kfree_skb()` or `dev_consume_skb_irq()` depending on
interrupt context. That logic gave me the sense that a similar issue
could exist elsewhere.
>
> ...
And read other driver codes and commit messages, check `networking/netdevices`
(.ndo_start_xmit), enable `netpoll` and set up `netconsole`, read
`net/core/netpoll.c`, read comment in `include/linux/netdevice.h`,
add countless `printk()`s, build millions of times... and so on.