Re: [PATCH 2/2] ipv4: igmp: annotate data-races around timer-related fields

From: Ido Schimmel

Date: Thu Jun 04 2026 - 06:25:26 EST


On Sun, May 31, 2026 at 11:07:04AM +0800, Yuyang Huang wrote:
> /proc/net/igmp walks the multicast list locklessly under RCU and reads
> timer-related fields (im->tm_running, im->reporter, im->timer.expires)
> to print the timer state of multicast memberships. Concurrently, these
> fields are modified under im->lock spinlock in timer management paths
> (igmp_stop_timer(), igmp_start_timer(), and igmp_timer_expire()). Fix this
> intentional lockless snapshot by annotating the lockless reads with
> READ_ONCE() and the updates with WRITE_ONCE().
>
> Fixes: 1d7138de878d ("igmp: RCU conversion of in_dev->mc_list")

Pending Paolo's approval, please drop the Fixes tag given the patch is
targeted at net-next.

> Signed-off-by: Yuyang Huang <yuyanghuang@xxxxxxxxxx>

Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>

[...]

> @@ -2964,6 +2964,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
> struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
> char *querier;
> long delta;
> + int tm_running;

Nit: Please move this above 'delta' for reverse xmas tree ordering

>
> #ifdef CONFIG_IP_MULTICAST
> querier = IGMP_V1_SEEN(state->in_dev) ? "V1" :