Changeset 47270


Ignore:
Timestamp:
2015-10-26T11:39:41+01:00 (2 years ago)
Author:
blogic
Message:

kernel: Fix environment pointer setup in ar71xx/ath79

Observed on ar71xx/ath79 platforms such as Ubiquiti RouterStations.Reported in #20642.:
(https://dev.archive.openwrt.org/ticket/20642.html).

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@…>
Tested-by: Stijn Tintel <stijn@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/patches-4.1/508-MIPS-ath79-prom-image-command-line-hack.patch

    r46427 r47270  
    11--- a/arch/mips/ath79/prom.c 
    22+++ b/arch/mips/ath79/prom.c 
    3 @@ -33,6 +33,35 @@ static void __init ath79_prom_append_cmd 
     3@@ -33,6 +33,41 @@ static void __init ath79_prom_append_cmd 
    44        strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline)); 
    55 } 
     
    2828+       } 
    2929+ 
     30+       /* Validate and setup environment pointer */ 
     31+       if (fw_arg2 < CKSEG0) 
     32+               _fw_envp = NULL; 
     33+       else 
     34+               _fw_envp = (int *)fw_arg2; 
     35+ 
    3036+       return 1; 
    3137+} 
     
    3743 { 
    3844        struct myloader_info *mylo; 
    39 @@ -61,6 +90,8 @@ static int __init ath79_prom_init_myload 
     45@@ -61,6 +96,8 @@ static int __init ath79_prom_init_myload 
    4046  
    4147        ath79_prom_append_cmdline("ethaddr", mac_buf); 
     
    4652 } 
    4753  
    48 @@ -71,7 +102,8 @@ void __init prom_init(void) 
     54@@ -71,7 +108,8 @@ void __init prom_init(void) 
    4955        if (ath79_prom_init_myloader()) 
    5056                return; 
     
    5662        env = fw_getenv("ethaddr"); 
    5763        if (env) 
     64--- a/arch/mips/fw/lib/cmdline.c 
     65+++ b/arch/mips/fw/lib/cmdline.c 
     66@@ -35,6 +35,7 @@ void __init fw_init_cmdline(void) 
     67        else 
     68                _fw_envp = (int *)fw_arg2; 
     69  
     70+       arcs_cmdline[0] = '\0'; 
     71        for (i = 1; i < fw_argc; i++) { 
     72                strlcat(arcs_cmdline, fw_argv(i), COMMAND_LINE_SIZE); 
     73                if (i < (fw_argc - 1)) 
Note: See TracChangeset for help on using the changeset viewer.