Re: [PATCH 3/3] firewire: core: fix memory leak in error path of build_tree()
From: Abdun Nihaal
Date: Wed Aug 12 2026 - 05:12:20 EST
On Tue, Aug 11, 2026 at 09:09:28PM +0900, Takashi Sakamoto wrote:
> In the error path of build_tree(), node instances can remain in the local
> linked list when the function returns.
>
> Whenever an invalid value is detected in the self ID sequence, each
> allocated node instance is either an entry in the linked list or an
> entry in the ports array of its parent node. Therefore, the allocate
> node instances can be safely released by traversing the linked list from
> its head.
>
> Release the remaining node instances with for_each_fw_node() before
> returning to the caller.
>
> Fixes: 3038e353cfaf ("firewire: Add core firewire stack.")
> Reported-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/all/20260727095955.104972-1-nihaal@xxxxxxxxxxxxxx/
> Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
Looks good to me. Thanks for fixing this.
I don't have a proper understanding of how the Firewire topology
construction happens, and was a bit confused by how the node->color
is used in the code, that's why I couldn't follow up with the fix.
Regards,
Nihaal