mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] ipv6: annotate data-races around devconf->rpl_seg_enabled
@ 2025-08-26  2:52 Yue Haibing
  2025-08-26  3:17 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 3+ messages in thread
From: Yue Haibing @ 2025-08-26  2:52 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms, kuniyu
  Cc: netdev, linux-kernel, yuehaibing

devconf->rpl_seg_enabled can be changed concurrently from
/proc/sys/net/ipv6/conf, annotate lockless reads on it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
 net/ipv6/exthdrs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index d1ef9644f826..a23eb8734e15 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -494,10 +494,8 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb)
 
 	idev = __in6_dev_get(skb->dev);
 
-	accept_rpl_seg = net->ipv6.devconf_all->rpl_seg_enabled;
-	if (accept_rpl_seg > idev->cnf.rpl_seg_enabled)
-		accept_rpl_seg = idev->cnf.rpl_seg_enabled;
-
+	accept_rpl_seg = min(READ_ONCE(net->ipv6.devconf_all->rpl_seg_enabled),
+			     READ_ONCE(idev->cnf.rpl_seg_enabled));
 	if (!accept_rpl_seg) {
 		kfree_skb(skb);
 		return -1;
-- 
2.34.1


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

* Re: [PATCH net-next] ipv6: annotate data-races around devconf->rpl_seg_enabled
  2025-08-26  2:52 [PATCH net-next] ipv6: annotate data-races around devconf->rpl_seg_enabled Yue Haibing
@ 2025-08-26  3:17 ` Kuniyuki Iwashima
  2025-08-26 13:32   ` Yue Haibing
  0 siblings, 1 reply; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-08-26  3:17 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev, linux-kernel

On Mon, Aug 25, 2025 at 7:51 PM Yue Haibing <yuehaibing@huawei.com> wrote:
>
> devconf->rpl_seg_enabled can be changed concurrently from
> /proc/sys/net/ipv6/conf, annotate lockless reads on it.
>
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
>  net/ipv6/exthdrs.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
> index d1ef9644f826..a23eb8734e15 100644
> --- a/net/ipv6/exthdrs.c
> +++ b/net/ipv6/exthdrs.c
> @@ -494,10 +494,8 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb)
>
>         idev = __in6_dev_get(skb->dev);
>
> -       accept_rpl_seg = net->ipv6.devconf_all->rpl_seg_enabled;
> -       if (accept_rpl_seg > idev->cnf.rpl_seg_enabled)
> -               accept_rpl_seg = idev->cnf.rpl_seg_enabled;
> -
> +       accept_rpl_seg = min(READ_ONCE(net->ipv6.devconf_all->rpl_seg_enabled),
> +                            READ_ONCE(idev->cnf.rpl_seg_enabled));
>         if (!accept_rpl_seg) {

Orthogonal to this change, but rpl_seg_enabled is missing .extra1/2
or this condition should be adjusted like other knobs that recognises
 <0 as disabled, .e.g. keep_addr_on_down, etc.


>                 kfree_skb(skb);
>                 return -1;
> --
> 2.34.1
>

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

* Re: [PATCH net-next] ipv6: annotate data-races around devconf->rpl_seg_enabled
  2025-08-26  3:17 ` Kuniyuki Iwashima
@ 2025-08-26 13:32   ` Yue Haibing
  0 siblings, 0 replies; 3+ messages in thread
From: Yue Haibing @ 2025-08-26 13:32 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev, linux-kernel

On 2025/8/26 11:17, Kuniyuki Iwashima wrote:
> On Mon, Aug 25, 2025 at 7:51 PM Yue Haibing <yuehaibing@huawei.com> wrote:
>>
>> devconf->rpl_seg_enabled can be changed concurrently from
>> /proc/sys/net/ipv6/conf, annotate lockless reads on it.
>>
>> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
>> ---
>>  net/ipv6/exthdrs.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
>> index d1ef9644f826..a23eb8734e15 100644
>> --- a/net/ipv6/exthdrs.c
>> +++ b/net/ipv6/exthdrs.c
>> @@ -494,10 +494,8 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb)
>>
>>         idev = __in6_dev_get(skb->dev);
>>
>> -       accept_rpl_seg = net->ipv6.devconf_all->rpl_seg_enabled;
>> -       if (accept_rpl_seg > idev->cnf.rpl_seg_enabled)
>> -               accept_rpl_seg = idev->cnf.rpl_seg_enabled;
>> -
>> +       accept_rpl_seg = min(READ_ONCE(net->ipv6.devconf_all->rpl_seg_enabled),
>> +                            READ_ONCE(idev->cnf.rpl_seg_enabled));
>>         if (!accept_rpl_seg) {
> 
> Orthogonal to this change, but rpl_seg_enabled is missing .extra1/2
> or this condition should be adjusted like other knobs that recognises
>  <0 as disabled, .e.g. keep_addr_on_down, etc.

Thanks, will add .extra1/2 check for this in v2.

> 
> 
>>                 kfree_skb(skb);
>>                 return -1;
>> --
>> 2.34.1
>>
> 

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

end of thread, other threads:[~2025-08-26 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-26  2:52 [PATCH net-next] ipv6: annotate data-races around devconf->rpl_seg_enabled Yue Haibing
2025-08-26  3:17 ` Kuniyuki Iwashima
2025-08-26 13:32   ` Yue Haibing

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®