Re: [PATCH 3/3] firewire: core: fix memory leak in error path of build_tree()
Abdun Nihaal <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.firewire.devel |
|---|---|
| Message-ID | <bulusztllqkcahb3hvpxw4dan5x5j5cura34swfyqaipujcdqw@wqzxom7bfrh3> |
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 <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Takashi Sakamoto <[email protected]>
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