diff mbox series

[OpenWrt-Devel] ar71xx: WNR612v2: fix kernel panic due to wrong Wifi LED init

Message ID 20180827202404.060527e1@kosmio.komorska
State Accepted
Delegated to: Mathias Kresin
Headers show
Series [OpenWrt-Devel] ar71xx: WNR612v2: fix kernel panic due to wrong Wifi LED init | expand

Commit Message

Michal Cieslakiewicz Aug. 27, 2018, 6:24 p.m. UTC
Netgear WNR612v2 flashed with recent OpenWrt builds suffers from kernel panic
at boot during wireless chip initialization, making device unusable 
(system enters 'panic-reboot' loop). TFTP recovery procedure is required
to load working image. 

LEDE-17.01 branch is working OK.
All later builds (OpenWrt-18.06, current) are affected (including stable 
official 18.06.1 image from downloads.openwrt.org).

Example log entry:

 ath: phy0: Ignoring endianness difference in EEPROM magic bytes.
 ath: phy0: Enable LNA combining
 CPU 0 Unable to handle kernel paging request at virtual address 1000fee1, epc == 801d08f0, ra == 801d0d90
 Oops[#1]:
 CPU: 0 PID: 469 Comm: kmodloader Not tainted 4.9.120 #0
 [ ... register dump etc ... ]
 Kernel panic - not syncing: Fatal exception
 Rebooting in 1 seconds..

This simple patch fixes above error. It keeps LED table in memory after kernel
init phase for ath9k driver to operate correctly (__initdata removed).
Also, another bug is fixed - correct array size is provided to function that
adds platform LEDs (this device has only 1 connected to Wifi chip) preventing 
code from going outside array bounds.
Patch tested succesfully (router boots OK) for both 18.06 and current trees.

Please accept and include this patch for both current and 18.06 trees (applies
to both branches identically) as without it WNR612v2 support is utterly broken.

Comments

Hartmut Knaack Aug. 27, 2018, 8:22 p.m. UTC | #1
Mathias Kresin would have been the one to CC, as he contributed that code.
I just added him now.


Michal Cieslakiewicz schrieb am 27.08.2018 um 20:24:
> Netgear WNR612v2 flashed with recent OpenWrt builds suffers from kernel panic
> at boot during wireless chip initialization, making device unusable 
> (system enters 'panic-reboot' loop). TFTP recovery procedure is required
> to load working image. 
> 
> LEDE-17.01 branch is working OK.
> All later builds (OpenWrt-18.06, current) are affected (including stable 
> official 18.06.1 image from downloads.openwrt.org).
> 
> Example log entry:
> 
>  ath: phy0: Ignoring endianness difference in EEPROM magic bytes.
>  ath: phy0: Enable LNA combining
>  CPU 0 Unable to handle kernel paging request at virtual address 1000fee1, epc == 801d08f0, ra == 801d0d90
>  Oops[#1]:
>  CPU: 0 PID: 469 Comm: kmodloader Not tainted 4.9.120 #0
>  [ ... register dump etc ... ]
>  Kernel panic - not syncing: Fatal exception
>  Rebooting in 1 seconds..
> 
> This simple patch fixes above error. It keeps LED table in memory after kernel
> init phase for ath9k driver to operate correctly (__initdata removed).
> Also, another bug is fixed - correct array size is provided to function that
> adds platform LEDs (this device has only 1 connected to Wifi chip) preventing 
> code from going outside array bounds.
> Patch tested succesfully (router boots OK) for both 18.06 and current trees.
> 
> Please accept and include this patch for both current and 18.06 trees (applies
> to both branches identically) as without it WNR612v2 support is utterly broken.
> 
> ===============================================================================
> Notice to all WNR612v2 owners: please do not flash WNR612v2 with anything newer
> than LEDE 17.01.x until bug mentioned here gets fixed.
> ===============================================================================
> 
> Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
> ---
>  target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
> index 6c18dc6d90..76c9cb99c9 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
> @@ -197,7 +197,7 @@ static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
>  	}
>  };
>  
> -static struct gpio_led wnr612v2_wmac_leds_gpio[] __initdata = {
> +static struct gpio_led wnr612v2_wmac_leds_gpio[] = {
>  	{
>  		.name		= "netgear:green:wlan",
>  		.gpio		= WNR612V2_GPIO_WMAC_LED_WLAN_GREEN,
> @@ -561,7 +561,7 @@ static void __init wnr612v2_setup(void)
>  				 wnr612v2_leds_gpio);
>  
>  	ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio,
> -				 ARRAY_SIZE(wnr612v2_leds_gpio));
> +				 ARRAY_SIZE(wnr612v2_wmac_leds_gpio));
>  
>  	ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio,
>  				 ARRAY_SIZE(wnr612v2_wmac_keys_gpio),
>
Mathias Kresin Aug. 28, 2018, 8:02 a.m. UTC | #2
27.08.2018 22:22, Hartmut Knaack:
> Mathias Kresin would have been the one to CC, as he contributed that code.
> I just added him now.

Please don't top post! It's a pain to follow the conversation this way.

Thanks a lot for fixing my mess. The patch is applied to master and the 
18.06. branch.

Mathias
Hartmut Knaack Aug. 28, 2018, 9:08 a.m. UTC | #3
Mathias Kresin schrieb am 28.08.2018 um 10:02:
> 27.08.2018 22:22, Hartmut Knaack:
>> Mathias Kresin would have been the one to CC, as he contributed that code.
>> I just added him now.
> 
> Please don't top post! It's a pain to follow the conversation this way.
> 

I generally agree with that rule, but pointing out who else should be cc'd
is commonly put on top.

Thanks,

Hartmut

> Thanks a lot for fixing my mess. The patch is applied to master and the 
> 18.06. branch.
> 
> Mathias
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Michal Cieslakiewicz Aug. 28, 2018, 12:53 p.m. UTC | #4
On Tue, 28 Aug 2018 10:02:46 +0200
Mathias Kresin <dev@kresin.me> wrote:
> 
> Thanks a lot for fixing my mess. The patch is applied to master and
> the 18.06. branch.
>
Thank you. You all people are making a great job and I'm glad I can
contribute a tiny bit.
I guess it is probably against deployment rules, but is it possible to
rebuild official OpenWrt 18.06.1 image for Netgear WNR612v2 with this
patch included ? Or, as a last resort, make existing OS images for this
router unavailable for download ?

Best regards
Michal
diff mbox series

Patch

===============================================================================
Notice to all WNR612v2 owners: please do not flash WNR612v2 with anything newer
than LEDE 17.01.x until bug mentioned here gets fixed.
===============================================================================

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
---
 target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
index 6c18dc6d90..76c9cb99c9 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
@@ -197,7 +197,7 @@  static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
 	}
 };
 
-static struct gpio_led wnr612v2_wmac_leds_gpio[] __initdata = {
+static struct gpio_led wnr612v2_wmac_leds_gpio[] = {
 	{
 		.name		= "netgear:green:wlan",
 		.gpio		= WNR612V2_GPIO_WMAC_LED_WLAN_GREEN,
@@ -561,7 +561,7 @@  static void __init wnr612v2_setup(void)
 				 wnr612v2_leds_gpio);
 
 	ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio,
-				 ARRAY_SIZE(wnr612v2_leds_gpio));
+				 ARRAY_SIZE(wnr612v2_wmac_leds_gpio));
 
 	ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio,
 				 ARRAY_SIZE(wnr612v2_wmac_keys_gpio),