netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH net] tun: prevent negative ifindex
Date: Mon, 16 Oct 2023 12:33:19 -0700	[thread overview]
Message-ID: <20231016123319.688bbd91@hermes.local> (raw)
In-Reply-To: <20231016180851.3560092-1-edumazet@google.com>

On Mon, 16 Oct 2023 18:08:51 +0000
Eric Dumazet <edumazet@google.com> wrote:

> +		ret = -EINVAL;
> +		if (ifindex < 0)
> +			goto unlock;

Shouldn't this be <= 0 since 0 is not a valid ifindex.
Zero ifindex is used as a sentinel in some API's

For example: if_nametoindex() returns 0 if name is not found.

  reply	other threads:[~2023-10-16 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 18:08 [PATCH net] tun: prevent negative ifindex Eric Dumazet
2023-10-16 19:33 ` Stephen Hemminger [this message]
2023-10-16 19:42   ` Eric Dumazet
2023-10-16 20:57     ` Stephen Hemminger
2023-10-17  0:55 ` Willem de Bruijn
2023-10-17  2:40   ` Jason Wang
2023-10-18  1:00 ` patchwork-bot+netdevbpf

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=20231016123319.688bbd91@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.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).