netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Serhey Popovych <serhe.popovych@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion
Date: Fri, 16 Jun 2017 09:16:59 -0700	[thread overview]
Message-ID: <20170616091659.3361b5d0@xeon-e3> (raw)
In-Reply-To: <a6cc35519e46dc988a983f4b167ccd420b42a0fa.1497621810.git.serhe.popovych@gmail.com>

On Fri, 16 Jun 2017 17:23:52 +0300
Serhey Popovych <serhe.popovych@gmail.com> wrote:

> If network device indexes exhaust in namespace dev_new_index()
> can loop indefinitely since there is no condition to exit
> except case where free index is found.
> 
> Since all it's caller hold RTNL mutex this may completely
> lock down network subsystem configuration operations.
> 
> Instead of retrying with ifindex == 1 (LOOPBACK_IFINDEX)
> in dev_new_index() we should fail and return invalid
> index value (0).
> 
> Adjust callers to correctly handle error case of dev_new_index().
> 
> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
 
This breaks existing semantics.

Today on Linux the ifindex allocator intentionally wraps around back to 1.
This is to handle the case of long running system with things like VPN's
that create and destroy lots of devices.

  reply	other threads:[~2017-06-16 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 14:23 [PATCH 0/3] dev: Fix network device ifindex allocation Serhey Popovych
2017-06-16 14:23 ` [PATCH 1/3] dev: Prevent creating network devices with negative ifindex Serhey Popovych
2017-06-16 16:18   ` Stephen Hemminger
2017-06-16 16:44     ` Serhey Popovych
2017-06-16 17:25       ` Stephen Hemminger
2017-06-16 18:14         ` Serhey Popovych
2017-06-16 14:23 ` [PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion Serhey Popovych
2017-06-16 16:16   ` Stephen Hemminger [this message]
2017-06-16 16:32     ` Serhey Popovych
2017-06-16 16:39     ` dev: Reclaim network device indexes Serhey Popovych
2017-06-20 16:42       ` David Miller
2017-06-16 14:23 ` [PATCH 3/3] veth: Set ifindex only if given and not negative Serhey Popovych

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=20170616091659.3361b5d0@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    --cc=serhe.popovych@gmail.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;
as well as URLs for NNTP newsgroup(s).