aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo@padovan.org>2012-05-13 02:20:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-14 13:51:25 -0400
commita7d7723ae7c0178d715c06c5621e8fd8014ba92f (patch)
tree8e09cd37ed267e792481c2ad699bcaff9596e5e7 /net/bluetooth/hci_event.c
parent574e02abaf816b582685805f0c1150ca9f1f18ee (diff)
Bluetooth: notify userspace of security level change
It fixes L2CAP socket based security level elevation during a connection. The HID profile needs this (for keyboards) and it is the only way to achieve the security level elevation when using the management interface to talk to the kernel (hence the management enabling patch being the one that exposes this issue). It enables the userspace a security level change when the socket is already connected and create a way to notify the socket the result of the request. At the moment of the request the socket is made non writable, if the request fails the connections closes, otherwise the socket is made writable again, POLL_OUT is emmited. Signed-off-by: Gustavo Padovan <gustavo@padovan.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6c065254afc0..53680fe84628 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2039,6 +2039,12 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2039 2039
2040 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); 2040 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
2041 2041
2042 if (ev->status && conn->state == BT_CONNECTED) {
2043 hci_acl_disconn(conn, 0x13);
2044 hci_conn_put(conn);
2045 goto unlock;
2046 }
2047
2042 if (conn->state == BT_CONFIG) { 2048 if (conn->state == BT_CONFIG) {
2043 if (!ev->status) 2049 if (!ev->status)
2044 conn->state = BT_CONNECTED; 2050 conn->state = BT_CONNECTED;
@@ -2049,6 +2055,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2049 hci_encrypt_cfm(conn, ev->status, ev->encrypt); 2055 hci_encrypt_cfm(conn, ev->status, ev->encrypt);
2050 } 2056 }
2051 2057
2058unlock:
2052 hci_dev_unlock(hdev); 2059 hci_dev_unlock(hdev);
2053} 2060}
2054 2061