<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/net/wireless, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/net/wireless?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/net/wireless?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-10-21T10:36:35Z</updated>
<entry>
<title>wifi: cfg80211: Fix bitrates overflow issue</title>
<updated>2022-10-21T10:36:35Z</updated>
<author>
<name>Paul Zhang</name>
<email>quic_paulz@quicinc.com</email>
</author>
<published>2022-10-11T13:04:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=18429c51c7ff6e6bfd627316c54670230967a7e5'/>
<id>urn:sha1:18429c51c7ff6e6bfd627316c54670230967a7e5</id>
<content type='text'>
When invoking function cfg80211_calculate_bitrate_eht about
(320 MHz, EHT-MCS 13, EHT-NSS 2, EHT-GI 0), which means the
parameters as flags: 0x80, bw: 7, mcs: 13, eht_gi: 0, nss: 2,
this formula (result * rate-&gt;nss) will overflow and causes
the returned bitrate to be 3959 when it should be 57646.

Here is the explanation:
 u64 tmp;
 u32 result;
 …
 /* tmp = result = 4 * rates_996[0]
  *     = 4 * 480388888 = 0x72889c60
  */
 tmp = result;

 /* tmp = 0x72889c60 * 6144 = 0xabccea90000 */
 tmp *= SCALE;

 /* tmp = 0xabccea90000 / mcs_divisors[13]
  *     = 0xabccea90000 / 5120 = 0x8970bba6
  */
 do_div(tmp, mcs_divisors[rate-&gt;mcs]);

 /* result = 0x8970bba6 */
 result = tmp;

 /* normally (result * rate-&gt;nss) = 0x8970bba6 * 2 = 0x112e1774c,
  * but since result is u32, (result * rate-&gt;nss) = 0x12e1774c,
  * overflow happens and it loses the highest bit.
  * Then result =  0x12e1774c / 8 = 39595753,
  */
 result = (result * rate-&gt;nss) / 8;

Signed-off-by: Paul Zhang &lt;quic_paulz@quicinc.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: fix memory leak in query_regdb_file()</title>
<updated>2022-10-21T10:35:57Z</updated>
<author>
<name>Arend van Spriel</name>
<email>arend.vanspriel@broadcom.com</email>
</author>
<published>2022-10-20T11:40:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=57b962e627ec0ae53d4d16d7bd1033e27e67677a'/>
<id>urn:sha1:57b962e627ec0ae53d4d16d7bd1033e27e67677a</id>
<content type='text'>
In the function query_regdb_file() the alpha2 parameter is duplicated
using kmemdup() and subsequently freed in regdb_fw_cb(). However,
request_firmware_nowait() can fail without calling regdb_fw_cb() and
thus leak memory.

Fixes: 007f6c5e6eb4 ("cfg80211: support loading regulatory database as firmware file")
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: silence a sparse RCU warning</title>
<updated>2022-10-21T10:34:46Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-10-13T17:41:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=03c0ad4b06c3566de624b4f4b78ac1a5d1e4c8e7'/>
<id>urn:sha1:03c0ad4b06c3566de624b4f4b78ac1a5d1e4c8e7</id>
<content type='text'>
All we're going to do with this pointer is assign it to
another __rcu pointer, but sparse can't see that, so
use rcu_access_pointer() to silence the warning here.

Fixes: c90b93b5b782 ("wifi: cfg80211: update hidden BSSes to avoid WARN_ON")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cve-fixes-2022-10-13'</title>
<updated>2022-10-13T09:59:56Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-10-13T09:59:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e7ad651c31c5e1289323e6c680be6e582a593b26'/>
<id>urn:sha1:e7ad651c31c5e1289323e6c680be6e582a593b26</id>
<content type='text'>
Pull in the fixes for various scan parsing bugs found by
Sönke Huster by fuzzing.
</content>
</entry>
<entry>
<title>wifi: cfg80211: update hidden BSSes to avoid WARN_ON</title>
<updated>2022-10-10T07:51:34Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-10-05T21:11:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=c90b93b5b782891ebfda49d4e5da36632fefd5d1'/>
<id>urn:sha1:c90b93b5b782891ebfda49d4e5da36632fefd5d1</id>
<content type='text'>
When updating beacon elements in a non-transmitted BSS,
also update the hidden sub-entries to the same beacon
elements, so that a future update through other paths
won't trigger a WARN_ON().

The warning is triggered because the beacon elements in
the hidden BSSes that are children of the BSS should
always be the same as in the parent.

Reported-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Tested-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: avoid nontransmitted BSS list corruption</title>
<updated>2022-10-10T07:51:01Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-09-30T22:01:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=bcca852027e5878aec911a347407ecc88d6fff7f'/>
<id>urn:sha1:bcca852027e5878aec911a347407ecc88d6fff7f</id>
<content type='text'>
If a non-transmitted BSS shares enough information (both
SSID and BSSID!) with another non-transmitted BSS of a
different AP, then we can find and update it, and then
try to add it to the non-transmitted BSS list. We do a
search for it on the transmitted BSS, but if it's not
there (but belongs to another transmitted BSS), the list
gets corrupted.

Since this is an erroneous situation, simply fail the
list insertion in this case and free the non-transmitted
BSS.

This fixes CVE-2022-42721.

Reported-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Tested-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: fix BSS refcounting bugs</title>
<updated>2022-10-10T07:50:51Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-09-30T21:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0b7808818cb9df6680f98996b8e9a439fa7bcc2f'/>
<id>urn:sha1:0b7808818cb9df6680f98996b8e9a439fa7bcc2f</id>
<content type='text'>
There are multiple refcounting bugs related to multi-BSSID:
 - In bss_ref_get(), if the BSS has a hidden_beacon_bss, then
   the bss pointer is overwritten before checking for the
   transmitted BSS, which is clearly wrong. Fix this by using
   the bss_from_pub() macro.

 - In cfg80211_bss_update() we copy the transmitted_bss pointer
   from tmp into new, but then if we release new, we'll unref
   it erroneously. We already set the pointer and ref it, but
   need to NULL it since it was copied from the tmp data.

 - In cfg80211_inform_single_bss_data(), if adding to the non-
   transmitted list fails, we unlink the BSS and yet still we
   return it, but this results in returning an entry without
   a reference. We shouldn't return it anyway if it was broken
   enough to not get added there.

This fixes CVE-2022-42720.

Reported-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Tested-by: Sönke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Fixes: a3584f56de1c ("cfg80211: Properly track transmitting and non-transmitting BSS")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: ensure length byte is present before access</title>
<updated>2022-10-10T07:50:37Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-09-29T19:50:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=567e14e39e8f8c6997a1378bc3be615afca86063'/>
<id>urn:sha1:567e14e39e8f8c6997a1378bc3be615afca86063</id>
<content type='text'>
When iterating the elements here, ensure the length byte is
present before checking it to see if the entire element will
fit into the buffer.

Longer term, we should rewrite this code using the type-safe
element iteration macros that check all of this.

Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Reported-by: Soenke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211/mac80211: reject bad MBSSID elements</title>
<updated>2022-10-10T07:50:15Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-09-28T20:01:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8f033d2becc24aa6bfd2a5c104407963560caabc'/>
<id>urn:sha1:8f033d2becc24aa6bfd2a5c104407963560caabc</id>
<content type='text'>
Per spec, the maximum value for the MaxBSSID ('n') indicator is 8,
and the minimum is 1 since a multiple BSSID set with just one BSSID
doesn't make sense (the # of BSSIDs is limited by 2^n).

Limit this in the parsing in both cfg80211 and mac80211, rejecting
any elements with an invalid value.

This fixes potentially bad shifts in the processing of these inside
the cfg80211_gen_new_bssid() function later.

I found this during the investigation of CVE-2022-41674 fixed by the
previous patch.

Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Fixes: 78ac51f81532 ("mac80211: support multi-bssid")
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>wifi: cfg80211: fix u8 overflow in cfg80211_update_notlisted_nontrans()</title>
<updated>2022-10-10T07:49:52Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2022-09-28T19:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=aebe9f4639b13a1f4e9a6b42cdd2e38c617b442d'/>
<id>urn:sha1:aebe9f4639b13a1f4e9a6b42cdd2e38c617b442d</id>
<content type='text'>
In the copy code of the elements, we do the following calculation
to reach the end of the MBSSID element:

	/* copy the IEs after MBSSID */
	cpy_len = mbssid[1] + 2;

This looks fine, however, cpy_len is a u8, the same as mbssid[1],
so the addition of two can overflow. In this case the subsequent
memcpy() will overflow the allocated buffer, since it copies 256
bytes too much due to the way the allocation and memcpy() sizes
are calculated.

Fix this by using size_t for the cpy_len variable.

This fixes CVE-2022-41674.

Reported-by: Soenke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Tested-by: Soenke Huster &lt;shuster@seemoo.tu-darmstadt.de&gt;
Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
</feed>
