]> git.itanic.dy.fi Git - linux-stable/commit
mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter()
authorEric Dumazet <edumazet@google.com>
Fri, 29 Apr 2022 16:20:36 +0000 (09:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 May 2022 10:32:37 +0000 (12:32 +0200)
commitd3a7333a8fb19384273ca57682416e2e3e9ea050
tree0b0530e7896b3dc41375ace605649c729ad26990
parent4807f902910c576a1e00a86868a2542d959d1b47
mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter()

commit a9384a4c1d250cb40cebf50e41459426d160b08e upstream.

Whenever RCU protected list replaces an object,
the pointer to the new object needs to be updated
_before_ the call to kfree_rcu() or call_rcu()

Also ip6_mc_msfilter() needs to update the pointer
before releasing the mc_lock mutex.

Note that linux-5.13 was supporting kfree_rcu(NULL, rcu),
so this fix does not need the conditional test I was
forced to use in the equivalent patch for IPv4.

Fixes: 882ba1f73c06 ("mld: convert ipv6_mc_socklist->sflist to RCU")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/mcast.c