Bug 9828

Summary: firewire-core: "kobject_add failed for fw5 with -EEXIST"
Product: Drivers Reporter: Stefan Richter (stefanr)
Component: IEEE1394Assignee: Stefan Richter (stefanr)
Status: CLOSED CODE_FIX    
Severity: low CC: jarod
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.22, 2.6.23, 2.6.24 Tree: Mainline
Regression: ---

Description Stefan Richter 2008-01-26 14:58:39 UTC
There are race conditions in the handling of drivers/firewire/fw-device.c::fw_device_idr which lead to firewire-core attempting to add new devices with same name as existing devices.  This notably happens if a device is being shut down with error conditions and a new device is being created at the same time.  See the WARNING in http://bugzilla.kernel.org/attachment.cgi?id=14580 for an example.

Both fw_device_init() and fw_device_shutdown() call idr_remove() too early.

Impact of the bug:  Happens rarely, forces the user to unplug and replug the new device to get it working.
Comment 1 Stefan Richter 2008-01-26 15:30:35 UTC
Correction: fw_device_init() looks fine, because only the code after successful device_add() matters.
Comment 2 Stefan Richter 2008-01-26 16:10:05 UTC
proposed patch: http://lkml.org/lkml/2008/1/26/228
Comment 3 Stefan Richter 2008-02-17 04:37:11 UTC
patch last updated on February 2: http://lkml.org/lkml/2008/2/2/108
committed to linux1394-2.6.git
planned to be submitted to mainline before 2.6.25
Comment 4 Stefan Richter 2008-02-28 02:24:29 UTC
fix merged by Linus