public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: bridge: annotate data-race in br_fdb_update()
@ 2026-01-06 19:40 Eric Dumazet
  2026-01-06 21:26 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2026-01-06 19:40 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet,
	Nikolay Aleksandrov

fdb->updated is read and written locklessly.

Add READ_ONCE()/WRITE_ONCE() annotations.

Fixes: 31cbc39b6344 ("net: bridge: add option to allow activity notifications for any fdb entries")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Nikolay Aleksandrov <razor@blackwall.org>
---
 net/bridge/br_fdb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 58d22e2b85fc3551bd5aec9c20296ddfcecaa040..e7bd20f0e8d6b7b24aef43d7bed34adf171c34a8 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1002,8 +1002,8 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 			unsigned long now = jiffies;
 			bool fdb_modified = false;
 
-			if (now != fdb->updated) {
-				fdb->updated = now;
+			if (now != READ_ONCE(fdb->updated)) {
+				WRITE_ONCE(fdb->updated, now);
 				fdb_modified = __fdb_mark_active(fdb);
 			}
 
-- 
2.52.0.351.gbe84eed79e-goog


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

* Re: [PATCH net] net: bridge: annotate data-race in br_fdb_update()
  2026-01-06 19:40 [PATCH net] net: bridge: annotate data-race in br_fdb_update() Eric Dumazet
@ 2026-01-06 21:26 ` Nikolay Aleksandrov
  2026-01-07  7:00   ` Nikolay Aleksandrov
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Aleksandrov @ 2026-01-06 21:26 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet

On 06/01/2026 21:40, Eric Dumazet wrote:
> fdb->updated is read and written locklessly.
> 
> Add READ_ONCE()/WRITE_ONCE() annotations.
> 
> Fixes: 31cbc39b6344 ("net: bridge: add option to allow activity notifications for any fdb entries")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Nikolay Aleksandrov <razor@blackwall.org>
> ---
>   net/bridge/br_fdb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 58d22e2b85fc3551bd5aec9c20296ddfcecaa040..e7bd20f0e8d6b7b24aef43d7bed34adf171c34a8 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -1002,8 +1002,8 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
>   			unsigned long now = jiffies;
>   			bool fdb_modified = false;
>   
> -			if (now != fdb->updated) {
> -				fdb->updated = now;
> +			if (now != READ_ONCE(fdb->updated)) {
> +				WRITE_ONCE(fdb->updated, now);
>   				fdb_modified = __fdb_mark_active(fdb);
>   			}
>   

Thanks,
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>

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

* Re: [PATCH net] net: bridge: annotate data-race in br_fdb_update()
  2026-01-06 21:26 ` Nikolay Aleksandrov
@ 2026-01-07  7:00   ` Nikolay Aleksandrov
  2026-01-07  7:03     ` Nikolay Aleksandrov
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Aleksandrov @ 2026-01-07  7:00 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet

On 06/01/2026 23:26, Nikolay Aleksandrov wrote:
> On 06/01/2026 21:40, Eric Dumazet wrote:
>> fdb->updated is read and written locklessly.
>>
>> Add READ_ONCE()/WRITE_ONCE() annotations.
>>
>> Fixes: 31cbc39b6344 ("net: bridge: add option to allow activity 
>> notifications for any fdb entries")
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> Cc: Nikolay Aleksandrov <razor@blackwall.org>
>> ---
>>   net/bridge/br_fdb.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
>> index 
>> 58d22e2b85fc3551bd5aec9c20296ddfcecaa040..e7bd20f0e8d6b7b24aef43d7bed34adf171c34a8 100644
>> --- a/net/bridge/br_fdb.c
>> +++ b/net/bridge/br_fdb.c
>> @@ -1002,8 +1002,8 @@ void br_fdb_update(struct net_bridge *br, struct 
>> net_bridge_port *source,
>>               unsigned long now = jiffies;
>>               bool fdb_modified = false;
>> -            if (now != fdb->updated) {
>> -                fdb->updated = now;
>> +            if (now != READ_ONCE(fdb->updated)) {
>> +                WRITE_ONCE(fdb->updated, now);
>>                   fdb_modified = __fdb_mark_active(fdb);
>>               }
> 
> Thanks,
> Acked-by: Nikolay Aleksandrov <razor@blackwall.org>

Actually on second thought, ->updated is used lockless in a few more
places, e.g. br_fdb_fillbuf(), fdb_fill_info(), br_fdb_cleanup().


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

* Re: [PATCH net] net: bridge: annotate data-race in br_fdb_update()
  2026-01-07  7:00   ` Nikolay Aleksandrov
@ 2026-01-07  7:03     ` Nikolay Aleksandrov
  2026-01-07  8:09       ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Aleksandrov @ 2026-01-07  7:03 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet

On 07/01/2026 09:00, Nikolay Aleksandrov wrote:
> On 06/01/2026 23:26, Nikolay Aleksandrov wrote:
>> On 06/01/2026 21:40, Eric Dumazet wrote:
>>> fdb->updated is read and written locklessly.
>>>
>>> Add READ_ONCE()/WRITE_ONCE() annotations.
>>>
>>> Fixes: 31cbc39b6344 ("net: bridge: add option to allow activity 
>>> notifications for any fdb entries")
>>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>>> Cc: Nikolay Aleksandrov <razor@blackwall.org>
>>> ---
>>>   net/bridge/br_fdb.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
>>> index 
>>> 58d22e2b85fc3551bd5aec9c20296ddfcecaa040..e7bd20f0e8d6b7b24aef43d7bed34adf171c34a8 100644
>>> --- a/net/bridge/br_fdb.c
>>> +++ b/net/bridge/br_fdb.c
>>> @@ -1002,8 +1002,8 @@ void br_fdb_update(struct net_bridge *br, 
>>> struct net_bridge_port *source,
>>>               unsigned long now = jiffies;
>>>               bool fdb_modified = false;
>>> -            if (now != fdb->updated) {
>>> -                fdb->updated = now;
>>> +            if (now != READ_ONCE(fdb->updated)) {
>>> +                WRITE_ONCE(fdb->updated, now);
>>>                   fdb_modified = __fdb_mark_active(fdb);
>>>               }
>>
>> Thanks,
>> Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
> 
> Actually on second thought, ->updated is used lockless in a few more
> places, e.g. br_fdb_fillbuf(), fdb_fill_info(), br_fdb_cleanup().
> 

I mean I see the subject, but since this patch will get backported
perhaps we can annotate all instances in one go.

Cheers,
  Nik


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

* Re: [PATCH net] net: bridge: annotate data-race in br_fdb_update()
  2026-01-07  7:03     ` Nikolay Aleksandrov
@ 2026-01-07  8:09       ` Eric Dumazet
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2026-01-07  8:09 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	netdev, eric.dumazet

On Wed, Jan 7, 2026 at 8:03 AM Nikolay Aleksandrov <razor@blackwall.org> wrote:
>
> On 07/01/2026 09:00, Nikolay Aleksandrov wrote:
> > On 06/01/2026 23:26, Nikolay Aleksandrov wrote:
> >> On 06/01/2026 21:40, Eric Dumazet wrote:
> >>> fdb->updated is read and written locklessly.
> >>>
> >>> Add READ_ONCE()/WRITE_ONCE() annotations.
> >>>
> >>> Fixes: 31cbc39b6344 ("net: bridge: add option to allow activity
> >>> notifications for any fdb entries")
> >>> Signed-off-by: Eric Dumazet <edumazet@google.com>
> >>> Cc: Nikolay Aleksandrov <razor@blackwall.org>
> >>> ---
> >>>   net/bridge/br_fdb.c | 4 ++--
> >>>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> >>> index
> >>> 58d22e2b85fc3551bd5aec9c20296ddfcecaa040..e7bd20f0e8d6b7b24aef43d7bed34adf171c34a8 100644
> >>> --- a/net/bridge/br_fdb.c
> >>> +++ b/net/bridge/br_fdb.c
> >>> @@ -1002,8 +1002,8 @@ void br_fdb_update(struct net_bridge *br,
> >>> struct net_bridge_port *source,
> >>>               unsigned long now = jiffies;
> >>>               bool fdb_modified = false;
> >>> -            if (now != fdb->updated) {
> >>> -                fdb->updated = now;
> >>> +            if (now != READ_ONCE(fdb->updated)) {
> >>> +                WRITE_ONCE(fdb->updated, now);
> >>>                   fdb_modified = __fdb_mark_active(fdb);
> >>>               }
> >>
> >> Thanks,
> >> Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
> >
> > Actually on second thought, ->updated is used lockless in a few more
> > places, e.g. br_fdb_fillbuf(), fdb_fill_info(), br_fdb_cleanup().
> >
>
> I mean I see the subject, but since this patch will get backported
> perhaps we can annotate all instances in one go.

Sure, I will send a V2, thanks.

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

end of thread, other threads:[~2026-01-07  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 19:40 [PATCH net] net: bridge: annotate data-race in br_fdb_update() Eric Dumazet
2026-01-06 21:26 ` Nikolay Aleksandrov
2026-01-07  7:00   ` Nikolay Aleksandrov
2026-01-07  7:03     ` Nikolay Aleksandrov
2026-01-07  8:09       ` Eric Dumazet

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