Skip to content

Commit

Permalink
ar71xx: mikrotik: bypass id check in __rb_get_wlan_data()
Browse files Browse the repository at this point in the history
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. Since ath10k caldata is no longer pulled from
this implementation, this commit also disables the publication in sysfs
to avoid wasting memory.

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@slashdirt.org>
  • Loading branch information
f00b4r0 authored and Koen Vandeputte committed May 12, 2020
1 parent 0fed36d commit 1c6990f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions target/linux/ar71xx/files/arch/mips/ath79/routerboot.c
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -300,6 +294,7 @@ rb_init_info(void *data, unsigned int size)
return &rb_info;
}

#if 0
static char *rb_ext_wlan_data;

static ssize_t
Expand Down Expand Up @@ -356,3 +351,4 @@ static int __init rb_sysfs_init(void)
}

late_initcall(rb_sysfs_init);
#endif

0 comments on commit 1c6990f

Please sign in to comment.