aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:45 -0400
committerMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:45 -0400
commit9719f8afce34d3d04e884873a8a5e3483e30974c (patch)
treeaee26f7df7e2d92aa54d4b9da88c4ff5987191dd /net/bluetooth/rfcomm
parent77db1980565626471a980f0d2d17299e4bd5e7a5 (diff)
[Bluetooth] Disconnect when encryption gets disabled
The Bluetooth specification allows to enable or disable the encryption of an ACL link at any time by either the peer or the remote device. If a L2CAP or RFCOMM connection requested an encrypted link, they will now disconnect that link if the encryption gets disabled. Higher protocols that don't care about encryption (like SDP) are not affected. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r--net/bluetooth/rfcomm/core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 1f92f9ab4959..e7a6a03cea37 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2003,6 +2003,14 @@ static void rfcomm_encrypt_cfm(struct hci_conn *conn, u8 status, u8 encrypt)
2003 list_for_each_safe(p, n, &s->dlcs) { 2003 list_for_each_safe(p, n, &s->dlcs) {
2004 d = list_entry(p, struct rfcomm_dlc, list); 2004 d = list_entry(p, struct rfcomm_dlc, list);
2005 2005
2006 if ((d->link_mode & (RFCOMM_LM_ENCRYPT | RFCOMM_LM_SECURE)) &&
2007 (d->state == BT_CONNECTED ||
2008 d->state == BT_CONFIG) &&
2009 !status && encrypt == 0x00) {
2010 __rfcomm_dlc_close(d, ECONNREFUSED);
2011 continue;
2012 }
2013
2006 if (!test_and_clear_bit(RFCOMM_AUTH_PENDING, &d->flags)) 2014 if (!test_and_clear_bit(RFCOMM_AUTH_PENDING, &d->flags))
2007 continue; 2015 continue;
2008 2016