Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
@ 2026-06-02  0:25 Runyu Xiao
  2026-06-04 10:20 ` Ido Schimmel
  2026-06-05  1:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Runyu Xiao @ 2026-06-02  0:25 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: dsahern, idosch, edumazet, horms, david.laight.linux, netdev,
	linux-kernel, jianhao.xu, runyu.xiao

ipv6_flowlabel_get() reads flowlabel_consistency and
flowlabel_state_ranges locklessly.

Use READ_ONCE() for these sysctl accesses.

Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
v2:
- Shorten the commit message per review feedback
- Drop the Fixes and stable CC trailers

 net/ipv6/ip6_flowlabel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index b1ccdf0dc646..1ab5ad0dcf24 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -620,7 +620,7 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq,
 	int err;
 
 	if (freq->flr_flags & IPV6_FL_F_REFLECT) {
-		if (net->ipv6.sysctl.flowlabel_consistency) {
+		if (READ_ONCE(net->ipv6.sysctl.flowlabel_consistency)) {
 			net_info_ratelimited("Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable\n");
 			return -EPERM;
 		}
@@ -633,7 +633,7 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq,
 
 	if (freq->flr_label & ~IPV6_FLOWLABEL_MASK)
 		return -EINVAL;
-	if (net->ipv6.sysctl.flowlabel_state_ranges &&
+	if (READ_ONCE(net->ipv6.sysctl.flowlabel_state_ranges) &&
 	    (freq->flr_label & IPV6_FLOWLABEL_STATELESS_FLAG))
 		return -ERANGE;
 
-- 
2.34.1

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

* Re: [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
  2026-06-02  0:25 [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get() Runyu Xiao
@ 2026-06-04 10:20 ` Ido Schimmel
  2026-06-05  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2026-06-04 10:20 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: davem, kuba, pabeni, dsahern, edumazet, horms, david.laight.linux,
	netdev, linux-kernel, jianhao.xu

On Tue, Jun 02, 2026 at 08:25:06AM +0800, Runyu Xiao wrote:
> ipv6_flowlabel_get() reads flowlabel_consistency and
> flowlabel_state_ranges locklessly.
> 
> Use READ_ONCE() for these sysctl accesses.
> 
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>

For net-next:

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

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

* Re: [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
  2026-06-02  0:25 [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get() Runyu Xiao
  2026-06-04 10:20 ` Ido Schimmel
@ 2026-06-05  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-05  1:40 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: davem, kuba, pabeni, dsahern, idosch, edumazet, horms,
	david.laight.linux, netdev, linux-kernel, jianhao.xu

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  2 Jun 2026 08:25:06 +0800 you wrote:
> ipv6_flowlabel_get() reads flowlabel_consistency and
> flowlabel_state_ranges locklessly.
> 
> Use READ_ONCE() for these sysctl accesses.
> 
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> 
> [...]

Here is the summary with links:
  - [net,v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
    https://git.kernel.org/netdev/net-next/c/f425c55cb60e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-06-05  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02  0:25 [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get() Runyu Xiao
2026-06-04 10:20 ` Ido Schimmel
2026-06-05  1:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox