since my webmailer screws up copy/pasted dmesg, i`m adding this to bugzilla for proper reporting and better tracking. originally reported to: To: linux-usb@vger.kernel.org Cc: dbrownell@users.sourceforge.net Date: Wed, 29 Dec 2010 21:51:13 +0100 (CET) Subject: BUG? g_printer module seems to have a problem when unloaded. i can reproduce this with 2.6.37-rc7 i think this is not expected behaviour !? modprobe g_printer modprobe -r g_printer Killed Dec 29 21:29:12 ubuntu kernel: [ 160.714195] dummy_hcd dummy_hcd: USB Host+Gadget Emulator, driver 02 May 2005 Dec 29 21:29:12 ubuntu kernel: [ 160.714418] dummy_hcd dummy_hcd: Dummy host controller Dec 29 21:29:12 ubuntu kernel: [ 160.715347] dummy_hcd dummy_hcd: new USB bus registered, assigned bus number 3 Dec 29 21:29:12 ubuntu kernel: [ 160.733118] hub 3-0:1.0: USB hub found Dec 29 21:29:12 ubuntu kernel: [ 160.733702] hub 3-0:1.0: 1 port detected Dec 29 21:29:12 ubuntu kernel: [ 160.790890] Printer Gadget: Printer Gadget, version: 2007 OCT 06 Dec 29 21:29:12 ubuntu kernel: [ 160.790918] Printer Gadget: using dummy_udc, OUT ep-b IN ep-a Dec 29 21:29:12 ubuntu kernel: [ 161.045647] usb 3-1: new high speed USB device using dummy_hcd and address 2 Dec 29 21:29:12 ubuntu kernel: [ 161.217955] Printer Gadget: high speed config #1: 2 mA, Printer Gadget Dec 29 21:29:12 ubuntu kernel: [ 161.276752] Printer Gadget: Using interface 0 Dec 29 21:29:12 ubuntu kernel: [ 161.283080] usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x0525 pid 0xA4A8 Dec 29 21:29:12 ubuntu kernel: [ 161.288866] usbcore: registered new interface driver usblp Dec 29 21:29:22 ubuntu kernel: [ 170.997443] *pde = 00000000 Dec 29 21:29:22 ubuntu kernel: [ 170.998225] Modules linked in: usblp g_printer(-) dummy_hcd snd_ens1371 gameport snd_rawmidi snd_seq_device snd_ac97_codec ac97_bus snd_pcm snd_timer psmouse snd ppdev intel_agp vmw_balloon intel_gtt soundcore lp serio_raw parport_pc snd_page_alloc shpchp agpgart parport i2c_piix4 mptspi mptscsih mptbase pcnet32 scsi_transport_spi floppy mii Dec 29 21:29:22 ubuntu kernel: [ 170.999574] Dec 29 21:29:22 ubuntu kernel: [ 170.999783] Pid: 934, comm: modprobe Not tainted 2.6.37-rc7 #3 440BX Desktop Reference Platform/VMware Virtual Platform Dec 29 21:29:22 ubuntu kernel: [ 171.000049] EIP: 0060:[ ] EFLAGS: 00010286 CPU: 0 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] EIP is at sysfs_delete_link+0x30/0x70 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] EAX: d97d86c0 EBX: de69848c ECX: d97d3240 EDX: 00000000 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] ESI: de686808 EDI: d97d3240 EBP: d9009ec0 ESP: d9009eb4 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] de686808 de686800 00000000 d9009ed0 c0406d6a de686800 de7a3b40 d9009ee4 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] c0407027 de686800 e0a4ce80 d977958c d9009ef0 c0407150 de686800 d9009f04 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] c0407192 c04062e0 0fb00000 e0a4d620 d9009f1c e0a4b5ad d97795a8 d9779104 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? device_remove_class_symlinks+0x5a/0x70 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? device_del+0x67/0x180 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? device_unregister+0x10/0x20 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? device_destroy+0x32/0x40 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? __match_devt+0x0/0x20 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? printer_unbind+0x2d/0x160 [g_printer] Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? usb_gadget_unregister_driver+0x85/0xd0 [dummy_hcd] Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? cleanup+0x38/0x60 [g_printer] Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? sys_delete_module+0x13d/0x200 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? do_munmap+0x212/0x300 Dec 29 21:29:22 ubuntu kernel: [ 171.000049] [ ] ? sysenter_do_call+0x12/0x28 Dec 29 21:29:22 ubuntu kernel: [ 171.023458] ---[ end trace 89b9a43c50cc3200 ]---
the oops also happens with standard 2.6.35-24-generic kernel from ubuntu 10.10
Created attachment 42552 [details] Fix unregistration bug in g_printer This patch fixes the bug you found, by unregistering the gadget driver before destroying the class instead of after. However the fix only exposes another bug, related to incorrect use of __initdata with module parameters. I'm still pursuing the correct solution to this second bug.
Created attachment 42722 [details] Remove __initdata from char * parameters Here's a patch to fix the other bug in g_printer. If you test the two patches together, everything should work okay.
merged for v2.6.38-rc3: commit d5aa475180d03d45c5dc6134aa833f1b3e89c45e Author: Alan Stern <stern@rowland.harvard.edu> Date: Mon Jan 10 11:23:05 2011 -0500 USB: g_printer: fix bug in unregistration
All USB bugs should be sent to the linux-usb@vger.kernel.org mailing list, and not entered into bugzilla. Please bring this issue up there, if it is still a problem in the latest kernel release.