Re: stopping and starting a functionfs USB-device causes panic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

andy_purcell@xxxxxxxxxxxx writes:
> Hello, 
>
> I have a second issue with a functionfs USB-device implementation. 
>
> The scenario is this: 
> 1) USB-device app starts up, runs fine
> 2) ssh to the device, kill the app with CTRL-C 
> 3) try to start the USB-device app 2nd time 
>
> PANIC 
>
> dmesg output: 
> [ 2553.870000] ------------[ cut here ]------------
> [ 2553.870000] kernel BUG at /var/lib/jenkins/workspace/Complete_PXYZ/.../kernel-source/fs/sysfs/file.c:332!
>
> [ 2553.870000] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
> [ 2553.870000] Modules linked in: designware_udc usb_f_fs libcomposite udc_core fuse configfs autofs4

what is this designware_udc? We don't have that in mainline

> [ 2553.870000] CPU: 0 PID: 1581 Comm: sh Not tainted 4.9.51-development #1
> [ 2553.870000] task: c73fe3e0 task.stack: c787e000
> [ 2553.870000] PC is at sysfs_create_file_ns+0x40/0x44
> [ 2553.870000] LR is at 0x1
> [ 2553.870000] pc : [<c01225ac>]    lr : [<00000001>]    psr: 60000013
>                sp : c787fe28  ip : 00000bf5  fp : 00000051
> [ 2553.870000] r10: c73ed000  r9 : 00000000  r8 : c72e31f0
> [ 2553.870000] r7 : c72e31c8  r6 : c7919c00  r5 : bf05d270  r4 : c72e3264
> [ 2553.870000] r3 : bf0411b4  r2 : 00000000  r1 : bf046908  r0 : 00000000
> [ 2553.870000] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
> [ 2553.870000] Control: 0005317f  Table: 07188000  DAC: 00000051
> [ 2553.870000] Process sh (pid: 1581, stack limit = 0xc787e190)
> [ 2553.870000] Stack: (0xc787fe28 to 0xc7880000)
> [ 2553.870000] fe20:                   c72e3264 bf05d270 c7919c00 bf04346c c7264400 c72e31f0
> [ 2553.870000] fe40: c6082b20 c72e31f0 c72e31f0 bf0449bc 00000002 c72e3264 c7b8cc00 bf05d270
> [ 2553.870000] fe60: c7125aa8 c7264400 c72e31f0 c6082b20 c72e31f0 bf038ec8 00000000 c73ed000
> [ 2553.870000] fe80: 00000051 bf037ec8 c7264400 bf038ee4 c6082b20 bf038388 c6082b20 c72e3000
> [ 2553.870000] fea0: c72e3190 c61c9078 0000000e bf0456c0 0000000e c61c9060 00108558 c61c9078
> [ 2553.870000] fec0: c787ff88 c7b8cc00 c73ed000 bf00b83c c787ff88 0000000e bf00b76c c7b8cc00
> [ 2553.870000] fee0: c787ff88 00000000 c787e000 00000000 000e902c c00bd7a4 49d54ab8 c787ffb0
> [ 2553.870000] ff00: 000e6614 00000241 be8cd7e4 c00092dc c71b6c40 0000000a c71efb40 00000001
> [ 2553.870000] ff20: be8cd7e4 c00db02c c6082fe0 0000000a 0000000a c04a65e0 00000000 00000000
> [ 2553.870000] ff40: c7b529b4 0000000e 00108558 c7b8cc00 c787ff88 00000000 c787e000 c00be5f0
> [ 2553.870000] ff60: c71efb40 00000001 c71b6c80 c7b8cc00 c7b8cc00 00108558 0000000e c000a5e4
> [ 2553.870000] ff80: c787e000 c00bf344 00000000 00000000 00000000 0000000e 00108558 49d54150
> [ 2553.870000] ffa0: 00000004 c000a440 0000000e 00108558 00000001 00108558 0000000e 00000000
> [ 2553.870000] ffc0: 0000000e 00108558 49d54150 00000004 0000000e 00000004 00000000 000e902c
> [ 2553.870000] ffe0: 00000000 be8cd70c 49c7c178 49cd5e8c 60000010 00000001 60042098 004c5010
> [ 2553.870000] [<c01225ac>] (sysfs_create_file_ns) from [<bf04346c>] (composite_dev_prepare+0x5c/0xe0 [libcomposite])
> [ 2553.870000] [<bf04346c>] (composite_dev_prepare [libcomposite]) from [<bf0449bc>] (configfs_composite_bind+0x2c/0x340 [libcomposite])
> [ 2553.870000] [<bf0449bc>] (configfs_composite_bind [libcomposite]) from [<bf037ec8>] (udc_bind_to_driver+0x2c/0xbc [udc_core])
> [ 2553.870000] [<bf037ec8>] (udc_bind_to_driver [udc_core]) from [<bf038388>] (usb_gadget_probe_driver+0xf0/0x13c [udc_core])
> [ 2553.870000] [<bf038388>] (usb_gadget_probe_driver [udc_core]) from [<bf0456c0>] (gadget_dev_desc_UDC_store+0xa8/0xc4 [libcomposite])
> [ 2553.870000] [<bf0456c0>] (gadget_dev_desc_UDC_store [libcomposite]) from [<bf00b83c>] (configfs_write_file+0xd0/0x15c [configfs])
> [ 2553.870000] [<bf00b83c>] (configfs_write_file [configfs]) from [<c00bd7a4>] (__vfs_write+0x1c/0x114)
> [ 2553.870000] [<c00bd7a4>] (__vfs_write) from [<c00be5f0>] (vfs_write+0xa0/0x168)
> [ 2553.870000] [<c00be5f0>] (vfs_write) from [<c00bf344>] (SyS_write+0x3c/0x90)
> [ 2553.870000] [<c00bf344>] (SyS_write) from [<c000a440>] (ret_fast_syscall+0x0/0x38)
> [ 2553.870000] Code: e1a0200e ebffff8c e28dd00c e49df004 (e7f001f2)
> [ 2553.870000] ---[ end trace cbce2f928593d16a ]---
>
> The panic is in kernel-source/fs/sysfs/file.c:332
>
> /**
>  * sysfs_create_file_ns - create an attribute file for an object with custom ns
>  * @kobj: object we're creating for
>  * @attr: attribute descriptor
>  * @ns: namespace the new file should belong to
>  */
> int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr,
>              const void *ns)
> {
>     BUG_ON(!kobj || !kobj->sd || !attr);     <== panic happens here 

this seems to be a bug in your designware_udc driver. The only way I can
see this happening is if gadget->dev isn't initialized. It could also be
a bug in your app. What do you do when you get your SIGINT? Are you
cleaning up after the app properly? Releasing your resources? unbinding
your functionfs from the UDC?

>     return sysfs_add_file_mode_ns(kobj->sd, attr, false, attr->mode, ns);
> }
>
>
> I inserted some printk()'s and found the panic is due to the !kobj->sd test. 
> The kobj and attr pointers are OK. Problem with kobj->sd. 
>
> I have tried all the easy things with no success. Still panics on 2nd start. 
> * after stopping, completely removing all functionfs files, directories, and rmmod of usb_f_fs, libcomposite, configfs

is your app writing to the UDC file on exit? After you kill the app,
what do you get when cating the UDC file?

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux