Subject: CVE-2021-47494: cfg80211: fix management registrations locking

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

cfg80211: fix management registrations locking

The management registrations locking was broken, the list was
locked for each wdev, but cfg80211_mgmt_registrations_update()
iterated it without holding all the correct spinlocks, causing
list corruption.

Rather than trying to fix it with fine-grained locking, just
move the lock to the wiphy/rdev (still need the list on each
wdev), we already need to hold the wdev lock to change it, so
there's no contention on the lock in any case. This trivially
fixes the bug since we hold one wdev's lock already, and now
will hold the lock that protects all lists.

The Linux kernel CVE team has assigned CVE-2021-47494 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.8 with commit 6cd536fe62ef and fixed in 5.10.77 with commit 4c22227e39c7
	Issue introduced in 5.8 with commit 6cd536fe62ef and fixed in 5.14.16 with commit 3c897f39b71f
	Issue introduced in 5.8 with commit 6cd536fe62ef and fixed in 5.15 with commit 09b1d5dc6ce1

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47494
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	include/net/cfg80211.h
	net/wireless/core.c
	net/wireless/core.h
	net/wireless/mlme.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/4c22227e39c7a0b4dab55617ee8d34d171fab8d4
	https://git.kernel.org/stable/c/3c897f39b71fe68f90599f6a45b5f7bf5618420e
	https://git.kernel.org/stable/c/09b1d5dc6ce1c9151777f6c4e128a59457704c97