Re: [BUG 4.9] New led trigger usbport gets the kernel to panic

From: Ralph Sennhauser
Date: Thu Dec 01 2016 - 09:29:36 EST


On Mon, 28 Nov 2016 23:20:13 +0100
Rafal Milecki <rafal@xxxxxxxxxx> wrote:

> Hi Ralph,
>
> On 11/21/2016 09:40 AM, Ralph Sennhauser wrote:
> > I tried your new usbport trigger in Linux 4.9 with little luck as
> > can be seen in the following output of the serial console.
>
> I'm really happy my trigger got some attention. I'm sorry it crashes
> for you, I never experienced any crash so far. I also got few ppl
> using it as part of LEDE project but no reports from them neither.
>
> Also sorry for the late reply, my private life took all my time
> previous week.
>
>

Hi Rafal

no worries, I know well how it is not to have enough time.

Below the oops with your debug patch applied.

Thanks
Ralph



root@wrt1900acs:/# cd sys/class/leds/pca963x\:shelby\:white\:usb2/
root@wrt1900acs:/sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/0-0068/leds/pca963x:shelby:white:usb2# echo usbport > trigger
[ 124.727665] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port:dd708240
[ 124.735266] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port->port_name:usb1-port1 port->data:dd708140
[ 124.745671] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port:dd7083c0
[ 124.753194] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port->port_name:usb2-port1 port->data:dd708140
[ 124.763594] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port:dd708300
[ 124.771114] leds pca963x:shelby:white:usb2: [usbport_trig_add_port] port->port_name:usb3-port1 port->data:dd708140
root@wrt1900acs:/sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/0-0068/leds/pca963x:shelby:white:usb2# echo 1 > ports/usb2-port1[ 171.649751] leds pca963x:shelby:white:usb2: [usbport_trig_port_store] buf:1
[ 171.649751] size:2

[ 171.660160] leds pca963x:shelby:white:usb2: [usbport_trig_port_store] port:dd7083c0
[ 171.668103] leds pca963x:shelby:white:usb2: [usbport_trig_port_store] port->port_name:usb2-port1 port->data:dd708140
[ 171.678678] [usbport_trig_update_count] usbport_data->count:0
[ 171.684457] [usbport_trig_update_count] usbport_data->count:0
[ 171.690253] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 171.698382] pgd = de71c000
[ 171.701102] [00000000] *pgd=1e362831, *pte=00000000, *ppte=00000000
[ 171.707427] Internal error: Oops: 80000007 [#1] SMP ARM
[ 171.712671] Modules linked in: iptable_nat nft_chain_nat_ipv4 nf_tables_inet
nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE
xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit
xt_conntrack xt_comment xt_TCP MSS xt_REDIRECT xt_LOG xt_CT nft_set_rbtree
nft_set_hash nft_reject_inet nft_reject nft_redir_ipv4 nft_redir nft_nat
nft_meta nft_masq_ipv4 nft_masq nft_log nft_limit nft_hash nft_exthdr nft_ct
nft_counter nft_chain_route_ipv6 nft_chain_route_ipv4 nf_tabl es_ipv6
nf_tables_ipv4 nf_tables nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4
nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_netlink
nf_conntrack macvlan libcrc32c iptable_raw iptable_mangle iptable_filter
ip_tables act_skbedit act _mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route
cls_fw sch_hfsc sch_ingress mwlwifi(O) mac80211 cfg80211 ledtrig_netdev(O)
ip_set_list_set ip_set_hash_netiface ip_set_hash_netport ip_set_hash_netnet
ip_set_hash_net ip_set_hash_netportnet ip_set_hash _mac ip_set_hash_ipportnet
ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip
ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink
ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw
ip6table_mangle ip6table_filter ip6_tables x_tables ifb sit tunnel4 ip_tunnel
vfat fat nls_utf8 nls_iso8859_1 nls_cp850 nls_cp437 rfkill input_core
sha256_generic seqiv jitterentropy_rng drbg hmac ghash_generic gf128mul gcm ctr
ccm ledtrig_usbport ext4 jbd2 mbcache btrf
s xor raid6_pq crc32c_generic ubifs ubi
[ 171.851028] CPU: 1 PID: 724 Comm: ash Tainted: G O 4.9.0-rc7 #2
[ 171.858103] Hardware name: Marvell Armada 380/385 (Device Tree)
[ 171.864046] task: df71bc80 task.stack: df7d0000
[ 171.868594] PC is at 0x0
[ 171.871139] LR is at usbport_trig_port_store+0x10c/0x17c [ledtrig_usbport]
[ 171.878042] pc : [<00000000>] lr : [<bf228270>] psr: 60000013
[ 171.878042] sp : df7d1e48 ip : 00000007 fp : df7d1e6c
[ 171.889566] r10: 00000000 r9 : 00000000 r8 : 00000000
[ 171.894811] r7 : df63c4ec r6 : deeec700 r5 : dd708140 r4 : 00000002
[ 171.901363] r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : df63c4ec
[ 171.907916] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 171.915079] Control: 10c5387d Table: 1e71c04a DAC: 00000051
[ 171.920847] Process ash (pid: 724, stack limit = 0xdf7d0210)
[ 171.926528] Stack: (0xdf7d1e48 to 0xdf7d2000)
[ 171.930902] 1e40: dd708140 ddc7a840 bf228164 00000002 df7d1f80 dd708500
[ 171.939114] 1e60: df7d1e84 df7d1e70 c0237e00 bf228170 c0237de0 00000002 df7d1e9c df7d1e88
[ 171.947325] 1e80: c01663f0 c0237dec decc3d80 00000002 df7d1edc df7d1ea0 c0165b98 c01663b4
[ 171.955537] 1ea0: 00000000 00000000 df5976d0 decc3d8c 32859b28 ddc7a840 c0165aa0 df7d1f80
[ 171.963748] 1ec0: 00000002 c000fc24 df7d0000 00000000 df7d1f4c df7d1ee0 c01006a8 c0165aac
[ 171.971959] 1ee0: 00000000 df7d1ee8 df7d1f14 df7d1ef8 df7d1f14 df7d1f00 c0060668 c0440838
[ 171.980171] 1f00: df7d1f50 df71bf50 df7d1f4c df7d1f18 c00298f8 c0060630 fffffff6 df7d1f68
[ 171.988382] 1f20: c00fec6c 00000007 00000002 ddc7a840 b6f7ff10 df7d1f80 c000fc24 df7d0000
[ 171.996592] 1f40: df7d1f7c df7d1f50 c0101514 c0100680 00000003 00000007 ddc7a840 ddc7a840
[ 172.004803] 1f60: b6f7ff10 00000002 c000fc24 df7d0000 df7d1fa4 df7d1f80 c010230c c0101474
[ 172.013014] 1f80: 00000000 00000000 00000000 00000000 00000020 00000004 00000000 df7d1fa8
[ 172.021226] 1fa0: c000fa60 c01022cc 00000000 00000000 00000001 b6f7ff10 00000002 00000000
[ 172.029437] 1fc0: 00000000 00000000 00000020 00000004 b6f7ff10 00000020 00059ec0 00059ea0
[ 172.037648] 1fe0: bef454f8 bef454e4 b6fcd904 b6fccdc8 60000010 00000001 e58d4004 e599c000
[ 172.045857] Backtrace:
[ 172.048327] [<bf228164>] (usbport_trig_port_store [ledtrig_usbport]) from [<c0237e00>] (dev_attr_store+0x20/0x2c)
[ 172.058631] r7:dd708500 r6:df7d1f80 r5:00000002 r4:bf228164
[ 172.064317] [<c0237de0>] (dev_attr_store) from [<c01663f0>] (sysfs_kf_write+0x48/0x4c)
[ 172.072265] r5:00000002 r4:c0237de0
[ 172.075856] [<c01663a8>] (sysfs_kf_write) from [<c0165b98>] (kernfs_fop_write+0xf8/0x1f8)
[ 172.084065] r5:00000002 r4:decc3d80
[ 172.087657] [<c0165aa0>] (kernfs_fop_write) from [<c01006a8>] (__vfs_write+0x34/0x120)
[ 172.095607] r10:00000000 r9:df7d0000 r8:c000fc24 r7:00000002 r6:df7d1f80 r5:c0165aa0
[ 172.103467] r4:ddc7a840
[ 172.106010] [<c0100674>] (__vfs_write) from [<c0101514>] (vfs_write+0xac/0x170)
[ 172.113350] r9:df7d0000 r8:c000fc24 r7:df7d1f80 r6:b6f7ff10 r5:ddc7a840 r4:00000002
[ 172.121125] [<c0101468>] (vfs_write) from [<c010230c>] (SyS_write+0x4c/0xa8)
[ 172.128202] r9:df7d0000 r8:c000fc24 r7:00000002 r6:b6f7ff10 r5:ddc7a840 r4:ddc7a840
[ 172.135979] [<c01022c0>] (SyS_write) from [<c000fa60>] (ret_fast_syscall+0x0/0x3c)
[ 172.143578] r7:00000004 r6:00000020 r5:00000000 r4:00000000
[ 172.149260] Code: bad PC value
[ 172.152357] ---[ end trace 0df651941c29a0cc ]---
[ 172.156994] Kernel panic - not syncing: Fatal exception
[ 172.162240] CPU0: stopping
[ 172.164959] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G D O 4.9.0-rc7 #2
[ 172.172384] Hardware name: Marvell Armada 380/385 (Device Tree)
[ 172.178326] Backtrace:
[ 172.180796] [<c00138a8>] (dump_backtrace) from [<c0013b7c>] (show_stack+0x18/0x1c)
[ 172.188398] r7:c07a1f08 r6:60000193 r5:c07b2744 r4:00000000
[ 172.194082] [<c0013b64>] (show_stack) from [<c01b2ab8>] (dump_stack+0x94/0xa8)
[ 172.201335] [<c01b2a24>] (dump_stack) from [<c0016bdc>] (handle_IPI+0x178/0x198)
[ 172.208760] r7:c07a1f08 r6:00000000 r5:00000000 r4:c07cb4f0
[ 172.214442] [<c0016a64>] (handle_IPI) from [<c00094e4>] (gic_handle_irq+0x90/0x94)
[ 172.222042] r7:c07a1f08 r6:e080210c r5:c07a3bb8 r4:c07b2a00
[ 172.227724] [<c0009454>] (gic_handle_irq) from [<c00146cc>] (__irq_svc+0x6c/0x90)
[ 172.235235] Exception stack(0xc07a1f08 to 0xc07a1f50)
[ 172.240308] 1f00: 00000001 00000000 00000000 c0020580 c07a0000 c07a302c
[ 172.248520] 1f20: c07a307c 00000001 00000000 00000000 c079d378 c07a1f64 c07a1f68 c07a1f58
[ 172.256729] 1f40: c00105ac c00105b0 60000013 ffffffff
[ 172.261801] r9:c07a0000 r8:00000000 r7:c07a1f3c r6:ffffffff r5:60000013 r4:c00105b0
[ 172.269579] [<c0010570>] (arch_cpu_idle) from [<c04406e4>] (default_idle_call+0x28/0x34)
[ 172.277707] [<c04406bc>] (default_idle_call) from [<c0061494>] (cpu_startup_entry+0x118/0x1f0)
[ 172.286354] [<c006137c>] (cpu_startup_entry) from [<c043ac2c>] (rest_init+0x7c/0x80)
[ 172.294128] r7:ffffffff
[ 172.296670] [<c043abb0>] (rest_init) from [<c052ad38>] (start_kernel+0x3bc/0x3c8)
[ 172.304184] [<c052a97c>] (start_kernel) from [<0000807c>] (0x807c)
[ 172.310391] Rebooting in 3 seconds..