[Bluetooth] Disconnect when encryption gets disabled
[deliverable/linux.git] / net / bluetooth / rfcomm / core.c
index 1f92f9ab495935f89476da32e06119abd9695a85..e7a6a03cea37e891d81c3c036140f9e30300108d 100644 (file)
@@ -2003,6 +2003,14 @@ static void rfcomm_encrypt_cfm(struct hci_conn *conn, u8 status, u8 encrypt)
        list_for_each_safe(p, n, &s->dlcs) {
                d = list_entry(p, struct rfcomm_dlc, list);
 
+               if ((d->link_mode & (RFCOMM_LM_ENCRYPT | RFCOMM_LM_SECURE)) &&
+                                       (d->state == BT_CONNECTED ||
+                                               d->state == BT_CONFIG) &&
+                                               !status && encrypt == 0x00) {
+                       __rfcomm_dlc_close(d, ECONNREFUSED);
+                       continue;
+               }
+
                if (!test_and_clear_bit(RFCOMM_AUTH_PENDING, &d->flags))
                        continue;
 
This page took 0.024921 seconds and 5 git commands to generate.