From: Carlos Llamas <cmllamas@google.com>
To: Riccardo Paolo Bestetti <pbl@bestov.io>
Cc: "David S . Miller" <davem@davemloft.net>,
"Hideaki YOSHIFUJI" <yoshfuji@linux-ipv6.org>,
"David Ahern" <dsahern@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, "Miaohe Lin" <linmiaohe@huawei.com>,
"Maciej Żenczykowski" <maze@google.com>
Subject: Re: [PATCH v2] ipv4: ping: fix bind address validity check
Date: Fri, 17 Jun 2022 16:39:21 +0000 [thread overview]
Message-ID: <YqyuOfvR4mesRTfe@google.com> (raw)
In-Reply-To: <20220617085435.193319-1-pbl@bestov.io>
On Fri, Jun 17, 2022 at 10:54:35AM +0200, Riccardo Paolo Bestetti wrote:
> Commit 8ff978b8b222 ("ipv4/raw: support binding to nonlocal addresses")
> introduced a helper function to fold duplicated validity checks of bind
> addresses into inet_addr_valid_or_nonlocal(). However, this caused an
> unintended regression in ping_check_bind_addr(), which previously would
> reject binding to multicast and broadcast addresses, but now these are
> both incorrectly allowed as reported in [1].
>
> This patch restores the original check. A simple reordering is done to
> improve readability and make it evident that multicast and broadcast
> addresses should not be allowed. Also, add an early exit for INADDR_ANY
> which replaces lost behavior added by commit 0ce779a9f501 ("net: Avoid
> unnecessary inet_addr_type() call when addr is INADDR_ANY").
>
> Furthermore, this patch introduces regression selftests to catch these
> specific cases.
>
> [1] https://lore.kernel.org/netdev/CANP3RGdkAcDyAZoT1h8Gtuu0saq+eOrrTiWbxnOs+5zn+cpyKg@mail.gmail.com/
>
> Fixes: 8ff978b8b222 ("ipv4/raw: support binding to nonlocal addresses")
> Cc: Miaohe Lin <linmiaohe@huawei.com>
> Reported-by: Maciej Żenczykowski <maze@google.com>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> Signed-off-by: Riccardo Paolo Bestetti <pbl@bestov.io>
> ---
> This patch is sent as a follow-up to the discussion on the v1 by Carlos
> Llamas.
>
> Original thread:
> https://lore.kernel.org/netdev/20220617020213.1881452-1-cmllamas@google.com/
>
Reviewed-by: Carlos Llamas <cmllamas@google.com>
Thanks Riccardo for adding the test cases. I would appreciate it if next
time you add a co-developed tag or maybe a separate commit as opposed to
overriding the original author. This is fine though.
--
Carlos Llamas
next prev parent reply other threads:[~2022-06-17 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 8:54 [PATCH v2] ipv4: ping: fix bind address validity check Riccardo Paolo Bestetti
2022-06-17 11:30 ` patchwork-bot+netdevbpf
2022-06-17 23:45 ` Maciej Żenczykowski
2022-06-20 10:11 ` Greg KH
2022-06-23 18:18 ` Maciej Żenczykowski
2022-06-25 14:26 ` Greg KH
2022-06-18 0:32 ` NEEDS FIXING - Was: " Riccardo Paolo Bestetti
2022-06-18 2:58 ` Jakub Kicinski
2022-06-18 7:36 ` Riccardo Paolo Bestetti
2022-06-19 16:44 ` Riccardo Paolo Bestetti
2022-06-17 16:39 ` Carlos Llamas [this message]
2022-06-17 18:26 ` Riccardo Paolo Bestetti
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=YqyuOfvR4mesRTfe@google.com \
--to=cmllamas@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kernel-team@android.com \
--cc=kuba@kernel.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pbl@bestov.io \
--cc=yoshfuji@linux-ipv6.org \
/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).