2017-08-22 21:59:48 +00:00
|
|
|
--- a/local-symbols
|
|
|
|
+++ b/local-symbols
|
mac80211: backport upstream fixes for FragAttacks
From the patch series description:
Several security issues in the 802.11 implementations were found by
Mathy Vanhoef (New York University Abu Dhabi), who has published all
the details at
https://papers.mathyvanhoef.com/usenix2021.pdf
Specifically, the following CVEs were assigned:
* CVE-2020-24586 - Fragmentation cache not cleared on reconnection
* CVE-2020-24587 - Reassembling fragments encrypted under different
keys
* CVE-2020-24588 - Accepting non-SPP A-MSDU frames, which leads to
payload being parsed as an L2 frame under an
A-MSDU bit toggling attack
* CVE-2020-26139 - Forwarding EAPOL from unauthenticated sender
* CVE-2020-26140 - Accepting plaintext data frames in protected
networks
* CVE-2020-26141 - Not verifying TKIP MIC of fragmented frames
* CVE-2020-26142 - Processing fragmented frames as full frames
* CVE-2020-26143 - Accepting fragmented plaintext frames in
protected networks
* CVE-2020-26144 - Always accepting unencrypted A-MSDU frames that
start with RFC1042 header with EAPOL ethertype
* CVE-2020-26145 - Accepting plaintext broadcast fragments as full
frames
* CVE-2020-26146 - Reassembling encrypted fragments with non-consecutive
packet numbers
* CVE-2020-26147 - Reassembling mixed encrypted/plaintext fragments
In general, the scope of these attacks is that they may allow an
attacker to
* inject L2 frames that they can more or less control (depending on the
vulnerability and attack method) into an otherwise protected network;
* exfiltrate (some) network data under certain conditions, this is
specific to the fragmentation issues.
A subset of these issues is known to apply to the Linux IEEE 802.11
implementation (mac80211). Where it is affected, the attached patches
fix the issues, even if not all of them reference the exact CVE IDs.
In addition, driver and/or firmware updates may be necessary, as well
as potentially more fixes to mac80211, depending on how drivers are
using it.
Specifically, for Intel devices, firmware needs to be updated to the
most recently released versions (which was done without any reference
to the security issues) to address some of the vulnerabilities.
To have a single set of patches, I'm also including patches for the
ath10k and ath11k drivers here.
We currently don't have information about how other drivers are, if
at all, affected.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-05-12 12:28:37 +00:00
|
|
|
@@ -333,6 +333,7 @@ RT2X00_LIB_FIRMWARE=
|
2013-11-12 22:11:33 +00:00
|
|
|
RT2X00_LIB_CRYPTO=
|
|
|
|
RT2X00_LIB_LEDS=
|
|
|
|
RT2X00_LIB_DEBUGFS=
|
|
|
|
+RT2X00_LIB_EEPROM=
|
|
|
|
RT2X00_DEBUG=
|
2015-12-04 22:39:37 +00:00
|
|
|
WLAN_VENDOR_REALTEK=
|
|
|
|
RTL8180=
|
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -70,6 +70,7 @@ config RT2800PCI
|
2013-11-12 22:11:33 +00:00
|
|
|
select RT2X00_LIB_MMIO
|
|
|
|
select RT2X00_LIB_PCI
|
|
|
|
select RT2X00_LIB_FIRMWARE
|
|
|
|
+ select RT2X00_LIB_EEPROM
|
|
|
|
select RT2X00_LIB_CRYPTO
|
|
|
|
depends on CRC_CCITT
|
|
|
|
depends on EEPROM_93CX6
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -216,6 +217,7 @@ config RT2800SOC
|
2013-11-12 22:11:33 +00:00
|
|
|
select RT2X00_LIB_MMIO
|
|
|
|
select RT2X00_LIB_CRYPTO
|
|
|
|
select RT2X00_LIB_FIRMWARE
|
|
|
|
+ select RT2X00_LIB_EEPROM
|
|
|
|
select RT2800_LIB
|
|
|
|
select RT2800_LIB_MMIO
|
2020-06-20 21:11:17 +00:00
|
|
|
help
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -266,6 +268,9 @@ config RT2X00_LIB_FIRMWARE
|
2013-11-12 22:11:33 +00:00
|
|
|
config RT2X00_LIB_CRYPTO
|
2015-03-11 15:02:47 +00:00
|
|
|
bool
|
2013-11-12 22:11:33 +00:00
|
|
|
|
|
|
|
+config RT2X00_LIB_EEPROM
|
2019-08-03 10:30:38 +00:00
|
|
|
+ bool
|
2013-11-12 22:11:33 +00:00
|
|
|
+
|
|
|
|
config RT2X00_LIB_LEDS
|
2015-03-11 15:02:47 +00:00
|
|
|
bool
|
2013-11-12 22:11:33 +00:00
|
|
|
default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n)
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/Makefile
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/Makefile
|
2018-09-23 16:02:35 +00:00
|
|
|
@@ -8,6 +8,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) +
|
2013-11-12 22:11:33 +00:00
|
|
|
rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
|
|
|
|
rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
|
|
|
|
rt2x00lib-$(CPTCFG_RT2X00_LIB_LEDS) += rt2x00leds.o
|
|
|
|
+rt2x00lib-$(CPTCFG_RT2X00_LIB_EEPROM) += rt2x00eeprom.o
|
|
|
|
|
|
|
|
obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o
|
|
|
|
obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -37,6 +37,8 @@ struct rt2800_drv_data {
|
2017-03-30 16:08:49 +00:00
|
|
|
struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
|
|
|
|
};
|
2013-11-12 22:11:33 +00:00
|
|
|
|
|
|
|
+#include "rt2800.h"
|
|
|
|
+
|
|
|
|
struct rt2800_ops {
|
2017-08-22 21:59:48 +00:00
|
|
|
u32 (*register_read)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset);
|
2019-08-03 10:30:38 +00:00
|
|
|
@@ -135,6 +137,15 @@ static inline int rt2800_read_eeprom(str
|
2013-11-12 22:11:33 +00:00
|
|
|
{
|
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
|
|
|
|
|
|
|
+ if (rt2x00dev->eeprom_file) {
|
|
|
|
+ memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data,
|
|
|
|
+ EEPROM_SIZE);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!rt2800ops->read_eeprom)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
return rt2800ops->read_eeprom(rt2x00dev);
|
|
|
|
}
|
|
|
|
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -90,19 +90,6 @@ static int rt2800soc_set_device_state(st
|
2013-11-12 22:11:33 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev)
|
|
|
|
-{
|
|
|
|
- void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
|
|
|
|
-
|
|
|
|
- if (!base_addr)
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
- memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);
|
|
|
|
-
|
|
|
|
- iounmap(base_addr);
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* Firmware functions */
|
|
|
|
static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev)
|
|
|
|
{
|
2020-04-18 21:36:48 +00:00
|
|
|
@@ -167,7 +154,6 @@ static const struct rt2800_ops rt2800soc
|
2013-11-12 22:11:33 +00:00
|
|
|
.register_multiread = rt2x00mmio_register_multiread,
|
|
|
|
.register_multiwrite = rt2x00mmio_register_multiwrite,
|
|
|
|
.regbusy_read = rt2x00mmio_regbusy_read,
|
|
|
|
- .read_eeprom = rt2800soc_read_eeprom,
|
|
|
|
.hwcrypt_disabled = rt2800soc_hwcrypt_disabled,
|
|
|
|
.drv_write_firmware = rt2800soc_write_firmware,
|
|
|
|
.drv_init_registers = rt2800mmio_init_registers,
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
2019-11-21 21:20:20 +00:00
|
|
|
@@ -694,6 +694,7 @@ enum rt2x00_capability_flags {
|
2013-11-12 22:11:33 +00:00
|
|
|
REQUIRE_HT_TX_DESC,
|
|
|
|
REQUIRE_PS_AUTOWAKE,
|
2014-09-27 20:51:43 +00:00
|
|
|
REQUIRE_DELAYED_RFKILL,
|
2013-11-12 22:11:33 +00:00
|
|
|
+ REQUIRE_EEPROM_FILE,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Capabilities
|
2019-11-21 21:20:20 +00:00
|
|
|
@@ -970,6 +971,11 @@ struct rt2x00_dev {
|
2013-11-12 22:11:33 +00:00
|
|
|
const struct firmware *fw;
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * EEPROM image.
|
|
|
|
+ */
|
|
|
|
+ const struct firmware *eeprom_file;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
* FIFO for storing tx status reports between isr and tasklet.
|
|
|
|
*/
|
|
|
|
DECLARE_KFIFO_PTR(txstatus_fifo, u32);
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
|
2020-11-13 19:14:09 +00:00
|
|
|
@@ -1406,6 +1406,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
|
2013-11-12 22:11:33 +00:00
|
|
|
INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
|
|
|
|
INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
|
|
|
|
|
|
|
|
+ retval = rt2x00lib_load_eeprom_file(rt2x00dev);
|
|
|
|
+ if (retval)
|
|
|
|
+ goto exit;
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Let the driver probe the device to detect the capabilities.
|
|
|
|
*/
|
2020-11-13 19:14:09 +00:00
|
|
|
@@ -1549,6 +1553,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
|
2014-09-27 20:51:43 +00:00
|
|
|
* Free the driver data.
|
2013-11-12 22:11:33 +00:00
|
|
|
*/
|
2014-09-27 20:51:43 +00:00
|
|
|
kfree(rt2x00dev->drv_data);
|
2013-11-12 22:11:33 +00:00
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Free EEPROM image.
|
|
|
|
+ */
|
|
|
|
+ rt2x00lib_free_eeprom_file(rt2x00dev);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
|
|
|
|
|
2011-07-03 15:02:04 +00:00
|
|
|
--- /dev/null
|
2015-12-04 22:39:37 +00:00
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
2019-02-24 09:23:18 +00:00
|
|
|
@@ -0,0 +1,106 @@
|
2011-07-03 15:02:04 +00:00
|
|
|
+/*
|
|
|
|
+ Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
|
|
|
|
+ Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
|
|
|
|
+ <http://rt2x00.serialmonkey.com>
|
|
|
|
+
|
|
|
|
+ This program is free software; you can redistribute it and/or modify
|
|
|
|
+ it under the terms of the GNU General Public License as published by
|
|
|
|
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ (at your option) any later version.
|
|
|
|
+
|
|
|
|
+ This program is distributed in the hope that it will be useful,
|
|
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ GNU General Public License for more details.
|
|
|
|
+
|
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
|
+ along with this program; if not, write to the
|
|
|
|
+ Free Software Foundation, Inc.,
|
|
|
|
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ Module: rt2x00lib
|
|
|
|
+ Abstract: rt2x00 eeprom file loading routines.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <linux/kernel.h>
|
|
|
|
+#include <linux/module.h>
|
|
|
|
+
|
|
|
|
+#include "rt2x00.h"
|
|
|
|
+#include "rt2x00lib.h"
|
|
|
|
+
|
2013-11-12 22:11:33 +00:00
|
|
|
+static const char *
|
|
|
|
+rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+ struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
|
|
|
|
+
|
|
|
|
+ if (pdata && pdata->eeprom_file_name)
|
|
|
|
+ return pdata->eeprom_file_name;
|
|
|
|
+
|
|
|
|
+ return NULL
|
|
|
|
+}
|
|
|
|
+
|
2011-07-03 15:02:04 +00:00
|
|
|
+static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+ const struct firmware *ee;
|
2014-01-30 13:21:36 +00:00
|
|
|
+ const char *ee_name;
|
2011-07-03 15:02:04 +00:00
|
|
|
+ int retval;
|
|
|
|
+
|
2013-11-12 22:11:33 +00:00
|
|
|
+ ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev);
|
2016-11-04 06:43:38 +00:00
|
|
|
+ if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) {
|
|
|
|
+ rt2x00_err(rt2x00dev, "Required EEPROM name is missing.");
|
2011-07-03 15:02:04 +00:00
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
2016-11-04 06:43:38 +00:00
|
|
|
+ if (!ee_name)
|
|
|
|
+ return 0;
|
|
|
|
+
|
2013-06-15 20:14:06 +00:00
|
|
|
+ rt2x00_info(rt2x00dev, "Loading EEPROM data from '%s'.\n", ee_name);
|
2011-07-03 15:02:04 +00:00
|
|
|
+
|
|
|
|
+ retval = request_firmware(&ee, ee_name, rt2x00dev->dev);
|
|
|
|
+ if (retval) {
|
2013-06-15 20:14:06 +00:00
|
|
|
+ rt2x00_err(rt2x00dev, "Failed to request EEPROM.\n");
|
2011-07-03 15:02:04 +00:00
|
|
|
+ return retval;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!ee || !ee->size || !ee->data) {
|
2013-06-15 20:14:06 +00:00
|
|
|
+ rt2x00_err(rt2x00dev, "Failed to read EEPROM file.\n");
|
2011-07-03 15:02:04 +00:00
|
|
|
+ retval = -ENOENT;
|
|
|
|
+ goto err_exit;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (ee->size != rt2x00dev->ops->eeprom_size) {
|
2013-06-15 20:14:06 +00:00
|
|
|
+ rt2x00_err(rt2x00dev,
|
|
|
|
+ "EEPROM file size is invalid, it should be %d bytes\n",
|
|
|
|
+ rt2x00dev->ops->eeprom_size);
|
2011-07-03 15:02:04 +00:00
|
|
|
+ retval = -EINVAL;
|
|
|
|
+ goto err_release_ee;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rt2x00dev->eeprom_file = ee;
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+err_release_ee:
|
|
|
|
+ release_firmware(ee);
|
|
|
|
+err_exit:
|
|
|
|
+ return retval;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+ int retval;
|
|
|
|
+
|
2016-11-04 06:43:38 +00:00
|
|
|
+ retval = rt2x00lib_request_eeprom_file(rt2x00dev);
|
|
|
|
+ if (retval)
|
|
|
|
+ return retval;
|
2011-07-03 15:02:04 +00:00
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
2019-02-24 09:23:18 +00:00
|
|
|
+ if (rt2x00dev->eeprom_file && rt2x00dev->eeprom_file->size)
|
|
|
|
+ release_firmware(rt2x00dev->eeprom_file);
|
2011-07-03 15:02:04 +00:00
|
|
|
+ rt2x00dev->eeprom_file = NULL;
|
|
|
|
+}
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -286,6 +286,22 @@ static inline void rt2x00lib_free_firmwa
|
2013-06-15 20:14:06 +00:00
|
|
|
#endif /* CPTCFG_RT2X00_LIB_FIRMWARE */
|
2011-07-03 15:02:04 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
+ * EEPROM file handlers.
|
|
|
|
+ */
|
2013-06-15 20:14:06 +00:00
|
|
|
+#ifdef CPTCFG_RT2X00_LIB_EEPROM
|
2011-07-03 15:02:04 +00:00
|
|
|
+int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev);
|
|
|
|
+void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev);
|
|
|
|
+#else
|
|
|
|
+static inline int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+static inline void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
|
|
|
+{
|
|
|
|
+}
|
2013-06-15 20:14:06 +00:00
|
|
|
+#endif /* CPTCFG_RT2X00_LIB_EEPROM */
|
2011-07-03 15:02:04 +00:00
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* Debugfs handlers.
|
|
|
|
*/
|
2013-06-15 20:14:06 +00:00
|
|
|
#ifdef CPTCFG_RT2X00_LIB_DEBUGFS
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
|
2019-07-06 22:08:20 +00:00
|
|
|
@@ -86,6 +86,7 @@ int rt2x00soc_probe(struct platform_devi
|
2017-02-02 11:02:22 +00:00
|
|
|
if (IS_ERR(rt2x00dev->clk))
|
|
|
|
rt2x00dev->clk = NULL;
|
2011-07-03 15:02:04 +00:00
|
|
|
|
2017-02-02 11:02:22 +00:00
|
|
|
+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
|
2011-07-03 15:02:04 +00:00
|
|
|
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
|
|
|
|
|
2017-02-02 11:02:22 +00:00
|
|
|
retval = rt2x00soc_alloc_reg(rt2x00dev);
|