[openwrt/openwrt] ar71xx: mikrotik: bypass id check in __rb_get_wlan_data()

LEDE Commits lede-commits at lists.infradead.org
Sat Oct 17 18:34:15 EDT 2020


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-18.06:
https://git.openwrt.org/ac56d253618c8c60794496518f2522863f24dedf

commit ac56d253618c8c60794496518f2522863f24dedf
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Fri Oct 2 23:37:05 2020 +0200

    ar71xx: mikrotik: bypass id check in __rb_get_wlan_data()
    
    The id parameter in __rb_get_wlan_data() was incorrectly used on the
    assumption that id "0" would always be tied to ath9k with RLE encoding
    and positive id (in fact, only id "1" was valid) would always be tied to
    ("external") ath10k with LZO encoding.
    
    Newer hardware revisions of supported devices prove this assumption to
    be invalid, with ath9k caldata being now wrapped in MAGIC_ERD and LZO
    compressed, so disable this check to allow newer hardware to correctly
    decode caldata for ath9k.
    
    Note: this patch assumes that ath9k caldata is never stored with the new
    "LZOR" encoding scheme found on some ath10k devices.
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
    (cherry picked from commit 1c6990fe6d198718850b6a37998416cac69f6f53)
    [keep publishing ath10k caldata in sysfs: it's the way it's done on 18.06]
    Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
    Tested-by: Baptiste Jonglez <git at bitsofnetworks.org> [Mikrotik RB941-2nD r3]
---
 target/linux/ar71xx/files/arch/mips/ath79/routerboot.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c
index 76776e1d84..945894f823 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c
@@ -206,10 +206,7 @@ __rb_get_wlan_data(u16 id)
 		u8 *erd_data;
 		u16 erd_len;
 
-		if (id == 0)
-			goto err_free;
-
-		err = routerboot_find_tag(tag, tag_len, id,
+		err = routerboot_find_tag(tag, tag_len, 0x1,
 					  &erd_data, &erd_len);
 		if (err) {
 			pr_err("no ERD data found for id %u\n", id);
@@ -224,9 +221,6 @@ __rb_get_wlan_data(u16 id)
 			goto err_free;
 		}
 	} else {
-		if (id != 0)
-			goto err_free;
-
 		err = rle_decode((char *) tag, tag_len, buf, RB_ART_SIZE,
 				 &src_done, &dst_done);
 		if (err) {



More information about the lede-commits mailing list