Thread (5 messages) 5 messages, 4 authors, 17d ago

Re: [PATCH] net: gemini: Free the shared queue after removing the ports

flat view

From: Linus Walleij <linusw@kernel.org>
Date: 2026-09-20 19:11:16
Also in: linux-arm-kernel, lkml

On Thu, Sep 17, 2026 at 9:28 PM Myeonghun Pak [off-list ref] wrote:
The software free queue is shared by both Ethernet ports, but each port
remove callback frees it. The parent also frees the queue before its
managed child devices are removed. This can free the queue while a port
or its threaded free-queue IRQ handler still uses it, and free the same
allocation again when the children are removed.

Keep the queue owned by the parent. Explicitly depopulate its child
devices before freeing it, so both ports are unregistered and their
managed IRQ handlers have been released. Disable the free-queue
interrupt after those handlers have drained, since the threaded handler
can re-enable it. Only clean up the queue if it was allocated; it may
never have been set up if neither interface was opened.

This issue was identified during our ongoing static-analysis research
while reviewing kernel code.

Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Assisted-by: LLM
Co-developed-by: Ijae Kim <redacted>
Signed-off-by: Ijae Kim <redacted>
Signed-off-by: Myeonghun Pak <redacted>
A good patch, but there is a better solution!

Replace the crazy freeq queue with a private
page pool.

I have been cooking a patch, let me test it on
hardware and send it out.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help