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

From: Linus Walleij

Date: Sun Sep 20 2026 - 15:11:26 EST


On Thu, Sep 17, 2026 at 9:28 PM Myeonghun Pak <mhun512@xxxxxxxxx> 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 <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>

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