ipv4: igmp: annotate data-races around idev->mr_maxdelay
Subsystems (3)
PATCH 1/1 ipv4: igmp: annotate data-races around idev->mr_maxdelay
idev->mr_maxdelay is read and written locklessly,
add READ_ONCE()/WRITE_ONCE() annotations.
While we are at it, make this field an u32.
--- include/linux/inetdevice.h | 2 +- net/ipv4/igmp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/inetdevice.h +1 -1
@@ -38,11 +38,11 @@ struct in_device {struct ip_mc_list *mc_tomb;unsigned long mr_v1_seen;unsigned long mr_v2_seen; -unsigned long mr_maxdelay;unsigned long mr_qi;/* Query Interval */ unsigned long mr_qri;/* Query Response Interval */ unsigned char mr_qrv;/* Query Robustness Variable */ unsigned char mr_gq_running; +u32 mr_maxdelay;u32 mr_ifc_count;struct timer_list mr_gq_timer;/* general query timer */ struct timer_list mr_ifc_timer;/* interface change timer */
net/ipv4/igmp.c +2 -2
@@ -227,7 +227,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)static void igmp_gq_start_timer (struct in_device *in_dev) { -int tv =get_random_u32_below (in_dev->mr_maxdelay); +int tv =get_random_u32_below (READ_ONCE (in_dev->mr_maxdelay));unsigned long exp = jiffies + tv +2 ; if (in_dev->mr_gq_running &&
@@ -1009,7 +1009,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, max_delay =IGMPV3_MRC (ih3->code)*(HZ /IGMP_TIMER_SCALE );if (!max_delay) max_delay =1 ;/* can't mod w/ 0 */ - in_dev->mr_maxdelay = max_delay; +WRITE_ONCE (in_dev->mr_maxdelay, max_delay);/* RFC3376, 4.1.6. QRV and 4.1.7. QQIC, when the most recently * received value was zero, use the default or statically
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Quoted 33 lines · Eric Dumazet
idev->mr_maxdelayis read and written locklessly,
add READ_ONCE()/WRITE_ONCE() annotations.While we are at it, make this field an u32.
Signed-off-by Eric Dumazet <[email protected]>--- include/linux/inetdevice.h | 2 +- net/ipv4/igmp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)include/linux/inetdevice.h +1
-1@@ -38,11 +38,11 @@ struct in_device {struct ip_mc_list *mc_tomb;unsigned long mr_v1_seen;unsigned long mr_v2_seen; -unsigned long mr_maxdelay;unsigned long mr_qi;/* Query Interval */ unsigned long mr_qri;/* Query Response Interval */ unsigned char mr_qrv;/* Query Robustness Variable */ unsigned char mr_gq_running; +u32 mr_maxdelay;u32 mr_ifc_count;struct timer_list mr_gq_timer;/* general query timer */ struct timer_list mr_ifc_timer;/* interface change timer */ net/ipv4/igmp.c +0
-0
net/ipv4/igmp.c static void igmp_start_timer(struct ip_mc_list *im, int max_delay) · line 230
Quoted 5 lines
net/ipv4/igmp.c +1
-1@@ -227,7 +227,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)static void igmp_gq_start_timer (struct in_device *in_dev) { -int tv =get_random_u32_below (in_dev->mr_maxdelay); +int tv =get_random_u32_below (READ_ONCE (in_dev->mr_maxdelay));
u32 tv? fix that type while at it.
net/ipv4/igmp.c static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, · line 1012
Quoted 9 lines
net/ipv4/igmp.c +1
-1unsigned long exp = jiffies + tv +2 ; if (in_dev->mr_gq_running &&@@ -1009,7 +1009,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, max_delay =IGMPV3_MRC (ih3->code)*(HZ /IGMP_TIMER_SCALE );if (!max_delay) max_delay =1 ;/* can't mod w/ 0 */ - in_dev->mr_maxdelay = max_delay; +WRITE_ONCE (in_dev->mr_maxdelay, max_delay);
max_delay can also be u32; only scope creep with this patch set is fixing up igmp_mod_timer to take u32.
net/ipv4/igmp.c static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, · line 1015
Quoted 3 lines
net/ipv4/igmp.c +0
-0/* RFC3376, 4.1.6. QRV and 4.1.7. QQIC, when the most recently * received value was zero, use the default or statically
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 22 Jan 2026 17:22:47 +0000 you wrote:
idev->mr_maxdelayis read and written locklessly,
add READ_ONCE()/WRITE_ONCE() annotations.While we are at it, make this field an u32.
Signed-off-by Eric Dumazet <[email protected]>[...]
Here is the summary with links:
- [net-next] ipv4: igmp: annotate data-races around idev->mr_maxdelay
https://git.kernel.org/netdev/net-next/c/e4faaf65a75f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html