Skip to contentSkip to conversation

flexcan introduced a DIV/0 in kernel

DISCUSSION Koen Vandeputte 4 participants 7 messages Apr 9, 2021 – Apr 12, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Reverting these fixes the splat.

Hope this helps,

Koen

[1]

[   10.062140] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator [   10.071631] Division by zero in kernel.
[   10.075511] CPU: 0 PID: 1061 Comm: kmodloader Not tainted 4.14.229 #0
[   10.081981] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   10.088529] Backtrace:
[   10.091040] [<8010ba30>] (dump_backtrace) from [<8010bdd4>] (show_stack+0x18/0x1c)
[   10.098631]  r7:9f5edc10 r6:60000013 r5:00000000 r4:80932c88
[   10.104336] [<8010bdbc>] (show_stack) from [<8063f8e0>] (dump_stack+0x9c/0xb0)
[   10.111591] [<8063f844>] (dump_stack) from [<8010bb90>] (__div0+0x1c/0x20)
[   10.118491]  r7:9f5edc10 r6:a0f0c000 r5:9ea3fd40 r4:9ea3f800
[   10.124199] [<8010bb74>] (__div0) from [<8063de94>] (Ldiv0+0x8/0x10)
[   10.130611] [<7f32b334>] (flexcan_mailbox_read [flexcan]) from [<7f32c480>] (flexcan_probe+0x360/0x468 [flexcan]) [   10.140902]  r7:9f5edc10 r6:a0f0c000 r5:9ea3fd40 r4:9ea3f800
[   10.146608] [<7f32c120>] (flexcan_probe [flexcan]) from [<8040f384>] (platform_drv_probe+0x60/0xb4) [   10.155698]  r10:80903c08 r9:00000000 r8:0000000d r7:fffffdfb r6:7f32e014 r5:fffffffe
[   10.163562]  r4:9f5edc10
[   10.166117] [<8040f324>] (platform_drv_probe) from [<8040db78>] (driver_probe_device+0x154/0x2ec) [   10.175012]  r7:7f32e014 r6:00000000 r5:9f5edc10 r4:80964928
[   10.180720] [<8040da24>] (driver_probe_device) from [<8040dd98>] (__driver_attach+0x88/0xac)
[   10.189195]  r9:7f32e080 r8:014000c0 r7:00000000 r6:9f5edc44 r5:7f32e014 r4:9f5edc10
[   10.196985] [<8040dd10>] (__driver_attach) from [<8040bfc0>] (bus_for_each_dev+0x54/0xa8)
[   10.205199]  r7:00000000 r6:8040dd10 r5:7f32e014 r4:00000000
[   10.210891] [<8040bf6c>] (bus_for_each_dev) from [<8040d4ac>] (driver_attach+0x24/0x28)
[   10.218912]  r6:9e41e880 r5:8091b340 r4:7f32e014
[   10.223559] [<8040d488>] (driver_attach) from [<8040d0a0>] (bus_add_driver+0xf4/0x204)
[   10.231529] [<8040cfac>] (bus_add_driver) from [<8040e4e8>] (driver_register+0xb0/0xec)
[   10.239574]  r7:7f331000 r6:00000000 r5:ffffe000 r4:7f32e014
[   10.245266] [<8040e438>] (driver_register) from [<8040f2d4>] (__platform_driver_register+0x48/0x50) [   10.254332]  r5:ffffe000 r4:80903c08
[   10.257953] [<8040f28c>] (__platform_driver_register) from [<7f331020>] (init_module+0x20/0x1000 [flexcan]) [   10.267729] [<7f331000>] (init_module [flexcan]) from [<80101a1c>] (do_one_initcall+0xc4/0x188) [   10.276490] [<80101958>] (do_one_initcall) from [<80192458>] (do_init_module+0x68/0x204)
[   10.284615]  r9:7f32e080 r8:014000c0 r7:00000000 r6:9e48b640 r5:9e4af000 r4:7f32e080
[   10.292389] [<801923f0>] (do_init_module) from [<801944b4>] (load_module+0x1e1c/0x220c)
[   10.300441]  r7:00000000 r6:9e4af1a8 r5:9e4af000 r4:9e8f3f30
[   10.306158] [<80192698>] (load_module) from [<80194a00>] (SyS_init_module+0x15c/0x17c)
[   10.314110]  r10:00000051 r9:000128ce r8:ffffe000 r7:001e545c r6:00000000 r5:a0f0945c
[   10.321957]  r4:0000345c
[   10.324541] [<801948a4>] (SyS_init_module) from [<801079e0>] (ret_fast_syscall+0x0/0x54)
[   10.332663]  r10:00000080 r9:9e8f2000 r8:80107be4 r7:00000080 r6:00000003 r5:00000000
[   10.340511]  r4:00000000
[   10.344089] flexcan 2090000.flexcan: device registered (reg_base=a0f0c000, irq=33)

#1 lore raw
Quoted 6 lines · Koen Vandeputte

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

Quoted 7 lines

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Reverting these fixes the splat.

This patch should fix the problem:

47c5e474bc1e can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

Greg, can you pick this up for v4.14?

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#2 lore raw
Quoted 13 lines · Marc Kleine-Budde
Quoted 12 lines · Koen Vandeputte

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Quoted 8 lines
Quoted 1 line

Reverting these fixes the splat.

This patch should fix the problem:

47c5e474bc1e can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

Greg, can you pick this up for v4.14?

Now queued up, thanks.

greg k-h

#3 lore raw
In reply to Marc Kleine-Budde
Quoted 16 lines · Marc Kleine-Budde
Quoted 6 lines · Koen Vandeputte

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

Quoted 7 lines

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Reverting these fixes the splat.

This patch should fix the problem:

Quoted 8 lines

47c5e474bc1e can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

Greg, can you pick this up for v4.14?

regards,
Marc

Checking kernels 4.4 & 4.9 shows that this fix is also missing over there.

Marc,

Can you confirm that it's also required for these?

Thanks,

Koen

#4 lore raw
Quoted 23 lines · Koen Vandeputte
Quoted 21 lines · Marc Kleine-Budde
Quoted 6 lines · Koen Vandeputte

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

Quoted 7 lines

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Reverting these fixes the splat.

This patch should fix the problem:

47c5e474bc1e can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

Greg, can you pick this up for v4.14?

Quoted 7 lines
Quoted 3 lines

regards,
Marc

Checking kernels 4.4 & 4.9 shows that this fix is also missing over there.

Marc,
Can you confirm that it's also required for these?

ACK, the fix is needed for v4.4.265 and v4.9.265.

Thanks for checking this,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#5 lore raw
Quoted 27 lines · Marc Kleine-Budde
Quoted 26 lines · Koen Vandeputte
Quoted 24 lines · Marc Kleine-Budde
Quoted 6 lines · Koen Vandeputte

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

Quoted 7 lines

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in flexcan_chip_freeze()")

Reverting these fixes the splat.

This patch should fix the problem:

47c5e474bc1e can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

Greg, can you pick this up for v4.14?

regards,
Marc

Quoted 6 lines
Quoted 4 lines

Checking kernels 4.4 & 4.9 shows that this fix is also missing over there.

Marc,
Can you confirm that it's also required for these?

ACK, the fix is needed for v4.4.265 and v4.9.265.

Now queued up there too, thanks!

greg k-h

#6 lore raw
In reply to Koen Vandeputte

Hi Koen, Mac,

Sorry about this regression, it has caused inconvenience to many people.

I tested the first version, but only double check the logic after improving the patch per Mac's advice.

I will keep in mind, test each version before upstream to avoid unexpected issues, sorry.

Best Regards,
Joakim Zhang

Quoted 98 lines

-----Original Message-----
From: Koen Vandeputte <[email protected]>
Sent: 2021年4月9日 18:18
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Joakim Zhang <[email protected]>; [email protected]
Subject: flexcan introduced a DIV/0 in kernel

Hi All,

I just updated kernel 4.14 within OpenWRT from 4.14.224 to 4.14.229 Booting it shows the splat below on each run. [1]

It seems there are 2 patches regarding flexcan which were introduced in 4.14.226

--> ce59ffca5c49 ("can: flexcan: enable RX FIFO after FRZ/HALT valid") --> bb7c9039a396 ("can: flexcan: assert FRZ bit in
--> flexcan_chip_freeze()")

Reverting these fixes the splat.

Hope this helps,

Koen

[1]

[   10.062140] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator [   10.071631] Division by zero in kernel. [   10.075511] CPU: 0 PID: 1061 Comm: kmodloader Not tainted 4.14.229 #0 [   10.081981] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [   10.088529] Backtrace:
[   10.091040] [<8010ba30>] (dump_backtrace) from [<8010bdd4>] (show_stack+0x18/0x1c)
[   10.098631]  r7:9f5edc10 r6:60000013 r5:00000000 r4:80932c88 [   10.104336] [<8010bdbc>] (show_stack) from [<8063f8e0>] (dump_stack+0x9c/0xb0)
[   10.111591] [<8063f844>] (dump_stack) from [<8010bb90>] (__div0+0x1c/0x20)
[   10.118491]  r7:9f5edc10 r6:a0f0c000 r5:9ea3fd40 r4:9ea3f800 [   10.124199] [<8010bb74>] (__div0) from [<8063de94>] (Ldiv0+0x8/0x10) [   10.130611] [<7f32b334>] (flexcan_mailbox_read [flexcan]) from [<7f32c480>] (flexcan_probe+0x360/0x468 [flexcan])
[   10.140902]  r7:9f5edc10 r6:a0f0c000 r5:9ea3fd40 r4:9ea3f800 [   10.146608] [<7f32c120>] (flexcan_probe [flexcan]) from [<8040f384>] (platform_drv_probe+0x60/0xb4)
[   10.155698]  r10:80903c08 r9:00000000 r8:0000000d r7:fffffdfb r6:7f32e014 r5:fffffffe
[   10.163562]  r4:9f5edc10
[   10.166117] [<8040f324>] (platform_drv_probe) from [<8040db78>] (driver_probe_device+0x154/0x2ec)
[   10.175012]  r7:7f32e014 r6:00000000 r5:9f5edc10 r4:80964928 [   10.180720] [<8040da24>] (driver_probe_device) from [<8040dd98>] (__driver_attach+0x88/0xac)
[   10.189195]  r9:7f32e080 r8:014000c0 r7:00000000 r6:9f5edc44 r5:7f32e014 r4:9f5edc10
[   10.196985] [<8040dd10>] (__driver_attach) from [<8040bfc0>] (bus_for_each_dev+0x54/0xa8)
[   10.205199]  r7:00000000 r6:8040dd10 r5:7f32e014 r4:00000000 [   10.210891] [<8040bf6c>] (bus_for_each_dev) from [<8040d4ac>] (driver_attach+0x24/0x28)
[   10.218912]  r6:9e41e880 r5:8091b340 r4:7f32e014 [   10.223559] [<8040d488>] (driver_attach) from [<8040d0a0>] (bus_add_driver+0xf4/0x204)
[   10.231529] [<8040cfac>] (bus_add_driver) from [<8040e4e8>] (driver_register+0xb0/0xec)
[   10.239574]  r7:7f331000 r6:00000000 r5:ffffe000 r4:7f32e014 [   10.245266] [<8040e438>] (driver_register) from [<8040f2d4>] (__platform_driver_register+0x48/0x50)
[   10.254332]  r5:ffffe000 r4:80903c08
[   10.257953] [<8040f28c>] (__platform_driver_register) from [<7f331020>] (init_module+0x20/0x1000 [flexcan]) [   10.267729] [<7f331000>] (init_module [flexcan]) from [<80101a1c>] (do_one_initcall+0xc4/0x188)
[   10.276490] [<80101958>] (do_one_initcall) from [<80192458>] (do_init_module+0x68/0x204)
[   10.284615]  r9:7f32e080 r8:014000c0 r7:00000000 r6:9e48b640 r5:9e4af000 r4:7f32e080
[   10.292389] [<801923f0>] (do_init_module) from [<801944b4>] (load_module+0x1e1c/0x220c)
[   10.300441]  r7:00000000 r6:9e4af1a8 r5:9e4af000 r4:9e8f3f30 [   10.306158] [<80192698>] (load_module) from [<80194a00>] (SyS_init_module+0x15c/0x17c)
[   10.314110]  r10:00000051 r9:000128ce r8:ffffe000 r7:001e545c r6:00000000 r5:a0f0945c
[   10.321957]  r4:0000345c
[   10.324541] [<801948a4>] (SyS_init_module) from [<801079e0>] (ret_fast_syscall+0x0/0x54)
[   10.332663]  r10:00000080 r9:9e8f2000 r8:80107be4 r7:00000080 r6:00000003 r5:00000000
[   10.340511]  r4:00000000
[   10.344089] flexcan 2090000.flexcan: device registered (reg_base=a0f0c000, irq=33)