From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: tariqt@mellanox.com, ranro@mellanox.com, maorg@mellanox.com,
edumazet@google.com, Florian Westphal <fw@strlen.de>
Subject: [PATCH net-next 1/2] net: ipv4: remove erroneous advancement of list pointer
Date: Mon, 17 Jun 2019 16:02:27 +0200 [thread overview]
Message-ID: <20190617140228.12523-2-fw@strlen.de> (raw)
In-Reply-To: <20190617140228.12523-1-fw@strlen.de>
Causes crash when lifetime expires on an adress as garbage is
dereferenced soon after.
This used to look like this:
for (ifap = &ifa->ifa_dev->ifa_list;
*ifap != NULL; ifap = &(*ifap)->ifa_next) {
if (*ifap == ifa) ...
but this was changed to:
struct in_ifaddr *tmp;
ifap = &ifa->ifa_dev->ifa_list;
tmp = rtnl_dereference(*ifap);
while (tmp) {
tmp = rtnl_dereference(tmp->ifa_next); // Bogus
if (rtnl_dereference(*ifap) == ifa) {
...
ifap = &tmp->ifa_next; // Can be NULL
tmp = rtnl_dereference(*ifap); // Dereference
}
}
Remove the bogus assigment/list entry skip.
Fixes: 2638eb8b50cf ("net: ipv4: provide __rcu annotation for ifa_list")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv4/devinet.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 925dffa915cb..914ccc7f192a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -745,8 +745,7 @@ static void check_lifetime(struct work_struct *work)
ifap = &ifa->ifa_dev->ifa_list;
tmp = rtnl_dereference(*ifap);
while (tmp) {
- tmp = rtnl_dereference(tmp->ifa_next);
- if (rtnl_dereference(*ifap) == ifa) {
+ if (tmp == ifa) {
inet_del_ifa(ifa->ifa_dev,
ifap, 1);
break;
--
2.21.0
next prev parent reply other threads:[~2019-06-17 14:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 14:02 [PATCH net-next 0/2] net: ipv4: remove erroneous advancement of list pointer Florian Westphal
2019-06-17 14:02 ` Florian Westphal [this message]
2019-06-17 14:02 ` [PATCH net-next 2/2] selftests: rtnetlink: add addresses with fixed life time Florian Westphal
2019-06-17 16:16 ` [PATCH net-next 0/2] net: ipv4: remove erroneous advancement of list pointer Tariq Toukan
2019-06-25 9:04 ` Ran Rozenstein
2019-06-25 9:19 ` Florian Westphal
2019-06-26 12:48 ` Ran Rozenstein
2019-06-26 20:37 ` Florian Westphal
2019-06-26 23:32 ` Florian Westphal
2019-06-17 23:27 ` David Miller
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=20190617140228.12523-2-fw@strlen.de \
--to=fw@strlen.de \
--cc=edumazet@google.com \
--cc=maorg@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ranro@mellanox.com \
--cc=tariqt@mellanox.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).