]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Handle bt_accept_enqueue() socket atomically
authorDean Jenkins <Dean_Jenkins@mentor.com>
Fri, 10 Mar 2017 11:34:45 +0000 (11:34 +0000)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Apr 2017 20:02:37 +0000 (22:02 +0200)
commit2aef92594f66ab02c2216636c58ddd05e2dd4f47
tree34b3f419909496745a134784e442b117d2cd87df
parent699314ecbfa9d46056ce3dcb649b855bab314ebc
Bluetooth: Handle bt_accept_enqueue() socket atomically

There is a small risk that bt_accept_unlink() runs concurrently with
bt_accept_enqueue() on the same socket. This scenario could potentially
lead to a NULL pointer dereference of the socket's parent member because
the socket can be on the list but the socket's parent member is not yet
updated by bt_accept_enqueue().

Therefore, add socket locking inside bt_accept_enqueue() so that the
socket is added to the list AND the parent's socket address is set in the
socket's parent member. The socket locking ensures that the socket is on
the list with a valid non-NULL parent member.

Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/af_bluetooth.c