mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zilin Guan <zilinguan811@gmail.com>
To: davem@davemloft.net
Cc: dsahern@kernel.org, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Zilin Guan <zilinguan811@gmail.com>
Subject: [PATCH] ipv6: Use local variable for ifa->flags in inet6_fill_ifaddr
Date: Mon,  4 Nov 2024 13:24:34 +0000	[thread overview]
Message-ID: <20241104132434.3101812-1-zilinguan811@gmail.com> (raw)

Currently, the inet6_fill_ifaddr() function reads the value of ifa->flags
using READ_ONCE() and stores it in the local variable flags. However,
the subsequent call to put_ifaddrmsg() uses ifa->flags again instead of
the already read local variable. This re-read is unnecessary because
no other thread can modify ifa->flags between the initial READ_ONCE()
and the subsequent use in put_ifaddrmsg().

Signed-off-by: Zilin Guan <zilinguan811@gmail.com>
---
 net/ipv6/addrconf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 94dceac52884..c4b080471b39 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5143,7 +5143,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb,
 		return -EMSGSIZE;
 
 	flags = READ_ONCE(ifa->flags);
-	put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope),
+	put_ifaddrmsg(nlh, ifa->prefix_len, flags, rt_scope(ifa->scope),
 		      ifa->idev->dev->ifindex);
 
 	if (args->netnsid >= 0 &&
-- 
2.34.1


             reply	other threads:[~2024-11-04 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 13:24 Zilin Guan [this message]
2024-11-04 13:54 ` Eric Dumazet

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=20241104132434.3101812-1-zilinguan811@gmail.com \
    --to=zilinguan811@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®