Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d724dbd authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "net: igmp: fix data-race in igmp_ifc_timer_expire()"



This reverts commit a9243455 which is
commit 4a2b285e7e103d4d6c6ed3e5052a0ff74a5d7f15 upstream.

It breaks the kernel abi (well the fix for this fix does), and is not
needed for Android devices.

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: I1c59c60493d216f1671b110a948f38293a0925ee
parent 50637be2
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -805,17 +805,10 @@ static void igmp_gq_timer_expire(struct timer_list *t)
static void igmp_ifc_timer_expire(struct timer_list *t)
{
	struct in_device *in_dev = from_timer(in_dev, t, mr_ifc_timer);
	u8 mr_ifc_count;

	igmpv3_send_cr(in_dev);
restart:
	mr_ifc_count = READ_ONCE(in_dev->mr_ifc_count);

	if (mr_ifc_count) {
		if (cmpxchg(&in_dev->mr_ifc_count,
			    mr_ifc_count,
			    mr_ifc_count - 1) != mr_ifc_count)
			goto restart;
	if (in_dev->mr_ifc_count) {
		in_dev->mr_ifc_count--;
		igmp_ifc_start_timer(in_dev,
				     unsolicited_report_interval(in_dev));
	}
@@ -827,7 +820,7 @@ static void igmp_ifc_event(struct in_device *in_dev)
	struct net *net = dev_net(in_dev->dev);
	if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev))
		return;
	WRITE_ONCE(in_dev->mr_ifc_count, in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv);
	in_dev->mr_ifc_count = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
	igmp_ifc_start_timer(in_dev, 1);
}

@@ -966,7 +959,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
				in_dev->mr_qri;
		}
		/* cancel the interface change timer */
		WRITE_ONCE(in_dev->mr_ifc_count, 0);
		in_dev->mr_ifc_count = 0;
		if (del_timer(&in_dev->mr_ifc_timer))
			__in_dev_put(in_dev);
		/* clear deleted report items */
@@ -1733,7 +1726,7 @@ void ip_mc_down(struct in_device *in_dev)
		igmp_group_dropped(pmc);

#ifdef CONFIG_IP_MULTICAST
	WRITE_ONCE(in_dev->mr_ifc_count, 0);
	in_dev->mr_ifc_count = 0;
	if (del_timer(&in_dev->mr_ifc_timer))
		__in_dev_put(in_dev);
	in_dev->mr_gq_running = 0;
@@ -1950,7 +1943,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
		pmc->sfmode = MCAST_INCLUDE;
#ifdef CONFIG_IP_MULTICAST
		pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
		WRITE_ONCE(in_dev->mr_ifc_count, pmc->crcount);
		in_dev->mr_ifc_count = pmc->crcount;
		for (psf = pmc->sources; psf; psf = psf->sf_next)
			psf->sf_crcount = 0;
		igmp_ifc_event(pmc->interface);
@@ -2129,7 +2122,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
		/* else no filters; keep old mode for reports */

		pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
		WRITE_ONCE(in_dev->mr_ifc_count, pmc->crcount);
		in_dev->mr_ifc_count = pmc->crcount;
		for (psf = pmc->sources; psf; psf = psf->sf_next)
			psf->sf_crcount = 0;
		igmp_ifc_event(in_dev);