From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] firewire: core: fix memory leak in error path of build_tree()
Date: Wed, 12 Aug 2026 19:21:58 +0900 [thread overview]
Message-ID: <20260812102158.GA719477@sakamocchi.jp> (raw)
In-Reply-To: <bulusztllqkcahb3hvpxw4dan5x5j5cura34swfyqaipujcdqw@wqzxom7bfrh3>
Hi,
On Wed, Aug 12, 2026 at 02:35:36PM +0530, Abdun Nihaal wrote:
> 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@cse.iitm.ac.in>
> > Link: https://lore.kernel.org/all/20260727095955.104972-1-nihaal@cse.iitm.ac.in/
> > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
>
> 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.
Yea. How the color member of fw_node/fw_card works was unclear to me too.
Writing some KUnit tests finally brought it to me.
Anyway, thank for your pointing and working for the issue.
Regards
Takashi Sakamoto
next prev parent reply other threads:[~2026-08-12 10:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 12:09 [PATCH 0/3] firewire: core: fix potential memory leak in build_tree() Takashi Sakamoto
2026-08-11 12:09 ` [PATCH 1/3] firewire: core: consolidate port counting " Takashi Sakamoto
2026-08-11 12:09 ` [PATCH 2/3] firewire: core: validate parent port count before allocating nodes " Takashi Sakamoto
2026-08-11 12:09 ` [PATCH 3/3] firewire: core: fix memory leak in error path of build_tree() Takashi Sakamoto
2026-08-12 9:05 ` Abdun Nihaal
2026-08-12 10:21 ` Takashi Sakamoto [this message]
2026-08-13 11:39 ` [PATCH 0/3] firewire: core: fix potential memory leak in build_tree() Takashi Sakamoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812102158.GA719477@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=nihaal@cse.iitm.ac.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.