diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-02-02 09:01:09 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-02-16 09:40:33 -0500 |
commit | 96b19062e741b715cf399312c30e0672d8889569 (patch) | |
tree | b0e2197ab7380590bdff00e02dde19e81952a33f /drivers/firewire/fw-device.h | |
parent | 1b9c12ba2fdf802a23630f70eddb0e821296634e (diff) |
firewire: fix "kobject_add failed for fw* with -EEXIST"
There is a race between shutdown and creation of devices: fw-core may
attempt to add a device with the same name of an already existing
device. http://bugzilla.kernel.org/show_bug.cgi?id=9828
Impact of the bug: Happens rarely (when shutdown of a device coincides
with creation of another), forces the user to unplug and replug the new
device to get it working.
The fix is obvious: Free the minor number *after* instead of *before*
device_unregister(). This requires to take an additional reference of
the fw_device as long as the IDR tree points to it.
And while we are at it, we fix an additional race condition:
fw_device_op_open() took its reference of the fw_device a little bit too
late, hence was in danger to access an already invalid fw_device.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device.h')
-rw-r--r-- | drivers/firewire/fw-device.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 0854fe2bc110..43808c02793e 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -77,13 +77,13 @@ fw_device_is_shutdown(struct fw_device *device) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | struct fw_device *fw_device_get(struct fw_device *device); | 79 | struct fw_device *fw_device_get(struct fw_device *device); |
80 | struct fw_device *fw_device_get_by_devt(dev_t devt); | ||
80 | void fw_device_put(struct fw_device *device); | 81 | void fw_device_put(struct fw_device *device); |
81 | int fw_device_enable_phys_dma(struct fw_device *device); | 82 | int fw_device_enable_phys_dma(struct fw_device *device); |
82 | 83 | ||
83 | void fw_device_cdev_update(struct fw_device *device); | 84 | void fw_device_cdev_update(struct fw_device *device); |
84 | void fw_device_cdev_remove(struct fw_device *device); | 85 | void fw_device_cdev_remove(struct fw_device *device); |
85 | 86 | ||
86 | struct fw_device *fw_device_from_devt(dev_t devt); | ||
87 | extern int fw_cdev_major; | 87 | extern int fw_cdev_major; |
88 | 88 | ||
89 | struct fw_unit { | 89 | struct fw_unit { |