mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipv6: Use local variable for ifa->flags in inet6_fill_ifaddr
@ 2024-11-04 13:24 Zilin Guan
  2024-11-04 13:54 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Zilin Guan @ 2024-11-04 13:24 UTC (permalink / raw)
  To: davem
  Cc: dsahern, edumazet, kuba, pabeni, horms, netdev, linux-kernel, Zilin Guan

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-04 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-04 13:24 [PATCH] ipv6: Use local variable for ifa->flags in inet6_fill_ifaddr Zilin Guan
2024-11-04 13:54 ` Eric Dumazet

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®