CVE-2022-49479: mt76: fix tx status related use-after-free race on station removal
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mt76: fix tx status related use-after-free race on station removal
There is a small race window where ongoing tx activity can lead to a skb getting added to the status tracking idr after that idr has already been cleaned up, which will keep the wcid linked in the status poll list. Fix this by only adding status skbs if the wcid pointer is still assigned in dev->wcid, which gets cleared early by mt76_sta_pre_rcu_remove
The Linux kernel CVE team has assigned CVE-2022-49479 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.16 with commit bd1e3e7b693c17a04e7d2bd9119daa482b7c7720 and fixed in 5.17.14 with commit ef7f9f894cfd0b2e471206409a529af4a26ddd55 Issue introduced in 5.16 with commit bd1e3e7b693c17a04e7d2bd9119daa482b7c7720 and fixed in 5.18.3 with commit ddd426d72aca4054045a9bd3b80a4ce1d398f11f Issue introduced in 5.16 with commit bd1e3e7b693c17a04e7d2bd9119daa482b7c7720 and fixed in 5.19 with commit fcfe1b5e162bf473c1d47760962cec8523c00466
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-2022-49479
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:
drivers/net/wireless/mediatek/mt76/mac80211.c drivers/net/wireless/mediatek/mt76/tx.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/ef7f9f894cfd0b2e471206409a529af4a26ddd55 https://git.kernel.org/stable/c/ddd426d72aca4054045a9bd3b80a4ce1d398f11f https://git.kernel.org/stable/c/fcfe1b5e162bf473c1d47760962cec8523c00466