summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-07-28 15:31:37 +0000
committerJonas Gorski <jogo@openwrt.org>2014-07-28 15:31:37 +0000
commitb723119385d9bd9b4c74284927e40c5a9fea8a57 (patch)
tree926710e7d6f89d50245d40f7e7759e2995e07447 /target
parentc21a20cd783d8f2376c4ec93210edf4783617d51 (diff)
downloadmtk-20170518-b723119385d9bd9b4c74284927e40c5a9fea8a57.zip
mtk-20170518-b723119385d9bd9b4c74284927e40c5a9fea8a57.tar.gz
mtk-20170518-b723119385d9bd9b4c74284927e40c5a9fea8a57.tar.bz2
brcm63xx: replace nvram_buf with a properly initialized array
Use an empty nvram_header to tell wl that there is no nvram buf. wl else might try to allocate huge amount of memory because the bcm63xx's nvram does not match the expected structure and contains random values. Fixes the following warning on load of wl: [ 9.152000] WARNING: at mm/slab_common.c:377 kmalloc_slab+0x4c/0xc0() [ 9.160000] Modules linked in: wl(P+) wl_glue ipv6 gpio_keys_polled input_polldev button_hotplug input_core [ 9.168000] CPU: 0 PID: 366 Comm: kmodloader Tainted: P 3.10.49 #1 [ 9.176000] Stack : 00000000 00000000 00000000 00000000 8034b77a 00000042 81ac9af0 c02e0000 [ 9.176000] 8028bf70 802df31b 0000016e 8034af28 81ac9af0 c02e0000 c02e0000 81b39810 [ 9.176000] 0000002d 8002c9d4 00000003 8002a3c8 802937a0 c02e0000 8028e528 81ab398c [ 9.176000] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 9.176000] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 81ab3918 [ 9.176000] ... [ 9.212000] Call Trace: [ 9.216000] [<800224b8>] show_stack+0x48/0x70 [ 9.220000] [<8002a538>] warn_slowpath_common+0x78/0xa8 [ 9.224000] [<8002a5f0>] warn_slowpath_null+0x18/0x24 [ 9.228000] [<8008145c>] kmalloc_slab+0x4c/0xc0 [ 9.236000] [<80097258>] __kmalloc+0x20/0x10c [ 9.240000] [<80e23b90>] osl_malloc+0x24/0x6c [wl] [ 9.244000] [<80e15288>] nvram_init+0x54/0x164 [wl] [ 9.252000] [<80e08668>] si_pci_fixcfg+0x60c/0x9e8 [wl] [ 9.256000] [ 9.260000] ---[ end trace b5c4dbb046cf3c83 ]--- Reported-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 41861
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm63xx/patches-3.10/800-wl_exports.patch13
-rw-r--r--target/linux/brcm63xx/patches-3.14/800-wl_exports.patch13
2 files changed, 4 insertions, 22 deletions
diff --git a/target/linux/brcm63xx/patches-3.10/800-wl_exports.patch b/target/linux/brcm63xx/patches-3.10/800-wl_exports.patch
index 096ea44..1879a8d 100644
--- a/target/linux/brcm63xx/patches-3.10/800-wl_exports.patch
+++ b/target/linux/brcm63xx/patches-3.10/800-wl_exports.patch
@@ -1,27 +1,18 @@
--- a/arch/mips/bcm63xx/nvram.c
+++ b/arch/mips/bcm63xx/nvram.c
-@@ -41,6 +41,13 @@ struct bcm963xx_nvram {
+@@ -41,6 +41,12 @@ struct bcm963xx_nvram {
static struct bcm963xx_nvram nvram;
static int mac_addr_used;
+/*
+ * Required export for WL
+ */
-+#define NVRAM_SPACE 0x8000
-+char nvram_buf[NVRAM_SPACE];
++u32 nvram_buf[5] = { 0, cpu_to_le32(20), 0, 0, 0 };
+EXPORT_SYMBOL(nvram_buf);
+
void __init bcm63xx_nvram_init(void *addr)
{
unsigned int check_len;
-@@ -49,6 +56,7 @@ void __init bcm63xx_nvram_init(void *add
-
- /* extract nvram data */
- memcpy(&nvram, addr, sizeof(nvram));
-+ memcpy(&nvram_buf, addr, NVRAM_SPACE);
-
- /* check checksum before using data */
- if (nvram.version <= 4) {
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -59,6 +59,7 @@ void (*_dma_cache_wback)(unsigned long s
diff --git a/target/linux/brcm63xx/patches-3.14/800-wl_exports.patch b/target/linux/brcm63xx/patches-3.14/800-wl_exports.patch
index 3e78c17..98bcee8 100644
--- a/target/linux/brcm63xx/patches-3.14/800-wl_exports.patch
+++ b/target/linux/brcm63xx/patches-3.14/800-wl_exports.patch
@@ -1,27 +1,18 @@
--- a/arch/mips/bcm63xx/nvram.c
+++ b/arch/mips/bcm63xx/nvram.c
-@@ -40,6 +40,13 @@ struct bcm963xx_nvram {
+@@ -40,6 +40,12 @@ struct bcm963xx_nvram {
static struct bcm963xx_nvram nvram;
static int mac_addr_used;
+/*
+ * Required export for WL
+ */
-+#define NVRAM_SPACE 0x8000
-+char nvram_buf[NVRAM_SPACE];
++u32 nvram_buf[5] = { 0, cpu_to_le32(20), 0, 0, 0 };
+EXPORT_SYMBOL(nvram_buf);
+
void __init bcm63xx_nvram_init(void *addr)
{
unsigned int check_len;
-@@ -48,6 +55,7 @@ void __init bcm63xx_nvram_init(void *add
-
- /* extract nvram data */
- memcpy(&nvram, addr, sizeof(nvram));
-+ memcpy(&nvram_buf, addr, NVRAM_SPACE);
-
- /* check checksum before using data */
- if (nvram.version <= 4) {
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -58,6 +58,7 @@ void (*_dma_cache_wback)(unsigned long s