firewire: Fix for broken configrom updates in quick succession
authorB.J. Buchalter <bj@mhlabs.com>
Mon, 2 May 2011 17:33:42 +0000 (13:33 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 22:06:42 +0000 (15:06 -0700)
commit74f85b46c2c2ddb5af3c26de627a4701c1951eb6
treea2e790a5372cc68d86e846f9848328bd86708dde
parenta41ee1d9242adc1cd4eaad4fcae727f778c394a9
firewire: Fix for broken configrom updates in quick succession

commit 2e053a27d9d5ad5e0831e002cbf8043836fb2060 upstream.

Current implementation of ohci_set_config_rom() uses a deferred
bus reset via fw_schedule_bus_reset(). If clients add multiple
unit descriptors to the config_rom in quick succession, the
deferred bus reset may not have fired before succeeding update
requests have come in. This can lead to an incorrect partial
update of the config_rom for both addition and removal of
config_rom descriptors, as the ohci_set_config_rom() routine
will return -EBUSY if a previous pending update has not been
completed yet; the requested update just gets dropped on the floor.

This patch recognizes that the "in-flight" update can be modified
until it has been processed by the bus-reset, and the locking
in the bus_reset_tasklet ensures that the update is done atomically
with respect to modifications made by ohci_set_config_rom(). The
-EBUSY error case is simply removed.

[Stefan R:  The bug always existed at least theoretically.  But it
became easy to trigger since 2.6.36 commit 02d37bed188c "firewire: core:
integrate software-forced bus resets with bus management" which
introduced long mandatory delays between janitorial bus resets.]

Signed-off-by: Benjamin Buchalter <bj@mhlabs.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/firewire/ohci.c