All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org,
	Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Subject: Re: [PATCH iproute2] iplink: fix fd leak when playing with netns
Date: Tue, 17 Sep 2024 08:11:02 -0700	[thread overview]
Message-ID: <20240917081102.4c00792f@hermes.local> (raw)
In-Reply-To: <20240917065158.2828026-1-nicolas.dichtel@6wind.com>

On Tue, 17 Sep 2024 08:51:58 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:

> The command 'ip link set foo netns mynetns' opens a file descriptor to fill
> the netlink attribute IFLA_NET_NS_FD. This file descriptor is never closed.
> When batch mode is used, the number of file descriptor may grow greatly and
> reach the maximum file descriptor number that can be opened.
> 
> This fd can be closed only after the netlink answer. Let's pass a new
> argument to iplink_parse() to remember this fd and close it.
> 
> Fixes: 0dc34c7713bb ("iproute2: Add processless network namespace support")
> Reported-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Tested-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
> ---

Maybe netns_fd should be a global variable rather than having to pass
to change all the unrelated function calls.

  reply	other threads:[~2024-09-17 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17  6:51 [PATCH iproute2] iplink: fix fd leak when playing with netns Nicolas Dichtel
2024-09-17 15:11 ` Stephen Hemminger [this message]
2024-09-17 15:17   ` Nicolas Dichtel
2024-09-17 19:04     ` Alexandre Ferrieux

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=20240917081102.4c00792f@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=alexandre.ferrieux@orange.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.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 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.