From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <bastien.curutchet@bootlin.com>
Cc: <alexis.lothore@bootlin.com>, <davem@davemloft.net>,
<edumazet@google.com>, <horms@kernel.org>, <kuba@kernel.org>,
<kuniyu@amazon.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<razor@blackwall.org>, <stable@vger.kernel.org>,
<thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH net 1/2] rtnetlink: Fix rtnl_net_cmp_locks() when DEBUG is off
Date: Wed, 12 Feb 2025 17:45:19 +0900 [thread overview]
Message-ID: <20250212084519.38648-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20250212-rtnetlink_leak-v1-1-27bce9a3ac9a@bootlin.com>
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com>
Date: Wed, 12 Feb 2025 09:23:47 +0100
> rtnl_net_cmp_locks() always returns -1 if CONFIG_DEBUG_NET_SMALL_RTNL is
> disabled. However, if CONFIG_DEBUG_NET_SMALL_RTNL is enabled, it returns 0
> when both inputs are equal. It is then used by rtnl_nets_add() to call
> put_net() if the net to be added is already present in the struct
> rtnl_nets. As a result, when rtnl_nets_add() is called on an already
> present net, put_net() is called only if DEBUG is on.
If CONFIG_DEBUG_NET_SMALL_RTNL is disabled, every duplicate net is
added to rtnl_nets, so put_net() is expected to be called for each
in rtnl_nets_destroy().
next prev parent reply other threads:[~2025-02-12 8:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 8:23 [PATCH net 0/2] rtnetlink: Fix small memory leaks Bastien Curutchet (eBPF Foundation)
2025-02-12 8:23 ` [PATCH net 1/2] rtnetlink: Fix rtnl_net_cmp_locks() when DEBUG is off Bastien Curutchet (eBPF Foundation)
2025-02-12 8:45 ` Kuniyuki Iwashima [this message]
2025-02-12 9:07 ` Bastien Curutchet
2025-02-12 8:23 ` [PATCH net 2/2] rtnetlink: Release nets when leaving rtnl_setlink() Bastien Curutchet (eBPF Foundation)
2025-02-12 8:31 ` Kuniyuki Iwashima
2025-02-12 9:05 ` Bastien Curutchet
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=20250212084519.38648-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=alexis.lothore@bootlin.com \
--cc=bastien.curutchet@bootlin.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=stable@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox