Bluetooth: hci_bcm: Fix race on close
authorLukas Wunner <lukas@wunner.de>
Wed, 10 Jan 2018 15:32:10 +0000 (16:32 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 10 Jan 2018 18:00:13 +0000 (19:00 +0100)
commit54ba69f9e7304e15e07713b4bb0eb1a405d271f0
treef75fa1d5c70ff6c66df2bb02b69ba249c768f246
parent6d83f1ee88a47d81f29d3aa4d17ad68d73473d40
Bluetooth: hci_bcm: Fix race on close

Upon ->close, the driver powers the Bluetooth controller down, deasserts
the device wake pin, updates the runtime PM status to "suspended" and
finally frees the IRQ.

Because the IRQ is freed last, a runtime resume can take place after
the controller was powered down.  The impact is not grave, the worst
thing that can happen is that the device wake pin is reasserted (should
have no effect while the regulator is off) and that setting the runtime
PM status to "suspended" does not reflect reality.

Still, it's wrong, so free the IRQ first.

Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_bcm.c