aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-10-26 10:39:41 +0000
committerJohn Crispin <blogic@openwrt.org>2015-10-26 10:39:41 +0000
commitc6cc29733422de4a24bc1565532669103ad5b558 (patch)
tree7489012a35c1a03a91125fc83fb8d5afc2528eaf
parent4669730434dd525cf3ba6c77118bfa6543e8a3a5 (diff)
downloadmaster-187ad058-c6cc29733422de4a24bc1565532669103ad5b558.tar.gz
master-187ad058-c6cc29733422de4a24bc1565532669103ad5b558.tar.bz2
master-187ad058-c6cc29733422de4a24bc1565532669103ad5b558.zip
kernel: Fix environment pointer setup in ar71xx/ath79
Observed on ar71xx/ath79 platforms such as Ubiquiti RouterStations.Reported in #20642.: (https://dev.openwrt.org/ticket/20642). If embedded command-line text exists with CONFIG_IMAGE_CMDLINE_HACK=y,firmware init doesn't initialize environment pointer (fw_init_cmdline not called). arcs_cmdline is not initialized before calling strlcat. Signed-off-by: Ted Hess <thess@kitschensync.net> Tested-by: Stijn Tintel <stijn@linux-ipv6.be> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47270 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch22
1 files changed, 19 insertions, 3 deletions
diff --git a/target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch b/target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch
index ff9f1aa141..cfa5e72eec 100644
--- a/target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch
+++ b/target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/prom.c
+++ b/arch/mips/ath79/prom.c
-@@ -33,6 +33,35 @@ static void __init ath79_prom_append_cmd
+@@ -33,6 +33,41 @@ static void __init ath79_prom_append_cmd
strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
}
@@ -27,6 +27,12 @@
+ strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
+ }
+
++ /* Validate and setup environment pointer */
++ if (fw_arg2 < CKSEG0)
++ _fw_envp = NULL;
++ else
++ _fw_envp = (int *)fw_arg2;
++
+ return 1;
+}
+#else
@@ -36,7 +42,7 @@
static int __init ath79_prom_init_myloader(void)
{
struct myloader_info *mylo;
-@@ -61,6 +90,8 @@ static int __init ath79_prom_init_myload
+@@ -61,6 +96,8 @@ static int __init ath79_prom_init_myload
ath79_prom_append_cmdline("ethaddr", mac_buf);
@@ -45,7 +51,7 @@
return 1;
}
-@@ -71,7 +102,8 @@ void __init prom_init(void)
+@@ -71,7 +108,8 @@ void __init prom_init(void)
if (ath79_prom_init_myloader())
return;
@@ -55,3 +61,13 @@
env = fw_getenv("ethaddr");
if (env)
+--- a/arch/mips/fw/lib/cmdline.c
++++ b/arch/mips/fw/lib/cmdline.c
+@@ -35,6 +35,7 @@ void __init fw_init_cmdline(void)
+ else
+ _fw_envp = (int *)fw_arg2;
+
++ arcs_cmdline[0] = '\0';
+ for (i = 1; i < fw_argc; i++) {
+ strlcat(arcs_cmdline, fw_argv(i), COMMAND_LINE_SIZE);
+ if (i < (fw_argc - 1))