diff options
author | Dean Jenkins <Dean_Jenkins@mentor.com> | 2017-05-05 16:27:06 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2017-05-18 13:52:50 +0200 |
commit | dec2c92880cc5435381d50e3045ef018a762a917 (patch) | |
tree | 3312e3a68788b6dd49d292dafdc38ae11b6ae1ee /drivers/pnp | |
parent | b56c7b2548a428d37b56951f419122ef4c75cc1b (diff) | |
download | linux-dec2c92880cc5435381d50e3045ef018a762a917.tar.bz2 |
Bluetooth: hci_ldisc: Use rwlocking to avoid closing proto races
When HCI_UART_PROTO_READY is in the set state, the Data Link protocol
layer (proto) is bound to the HCI UART driver. This state allows the
registered proto function pointers to be used by the HCI UART driver.
When unbinding (closing) the Data Link protocol layer, the proto
function pointers much be prevented from being used immediately before
running the proto close function pointer. Otherwise, there is a risk
that a proto non-close function pointer is used during or after the
proto close function pointer is used. The consequences are likely to
be a kernel crash because the proto close function pointer will free
resources used in the Data Link protocol layer.
Therefore, add a reader writer lock (rwlock) solution to prevent the
close proto function pointer from running by using write_lock_irqsave()
whilst the other proto function pointers are protected using
read_lock(). This means HCI_UART_PROTO_READY can safely be cleared
in the knowledge that no proto function pointers are running.
When flag HCI_UART_PROTO_READY is put into the clear state,
proto close function pointer can safely be run. Note
flag HCI_UART_PROTO_SET being in the set state prevents the proto
open function pointer from being run so there is no race condition
between proto open and close function pointers.
Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/pnp')
0 files changed, 0 insertions, 0 deletions