linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Keith Packard" <keithp@keithp.com>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>,
	Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	linux-bluetooth@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Regression caused by "Bluetooth: Map sec_level to link key requirements"
Date: Thu, 09 Jun 2011 00:20:55 -0700	[thread overview]
Message-ID: <yunboy7a2so.fsf@aiko.keithp.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3686 bytes --]


Patch 13d39315c22b128f4796fc008b04914a7c32bb1a is causing a regression
From 2.6.39. I cannot communicate with my Nokia N900 using either the
SyncML or DUN RFCOMM services.  I get a connection reset error shortly
after startup.

I've reverted this patch on top of something past -rc2 (to be precise,
I'm branching from ef2398019b305827ea7130ebaf7bf521b444530e).
With the following fix-up to make things build again, my bluetooth works
again.

From 9774a1309ef662308c6ffb7db160788f6e2b5e35 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Thu, 9 Jun 2011 00:11:33 -0700
Subject: [PATCH 2/2] net/bluetooth: Clean up revert of 13d39315c22b128f4796fc008b04914a7c32bb1a.

This removes lingering references to key_type and makes the code work
like it did before the offending commit.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 net/bluetooth/hci_conn.c    |   17 -----------------
 net/bluetooth/hci_core.c    |    4 +---
 net/bluetooth/hci_event.c   |    1 -
 net/bluetooth/rfcomm/core.c |    2 +-
 4 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 25c4ea0..de3a4c0 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -582,23 +582,6 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
 }
 EXPORT_SYMBOL(hci_conn_security);
 
-/* Check secure link requirement */
-int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level)
-{
-	BT_DBG("conn %p", conn);
-
-	if (sec_level != BT_SECURITY_HIGH)
-		return 1; /* Accept if non-secure is required */
-
-	if (conn->key_type == HCI_LK_AUTH_COMBINATION ||
-			(conn->key_type == HCI_LK_COMBINATION &&
-			conn->pin_length == 16))
-		return 1;
-
-	return 0; /* Reject not secure link */
-}
-EXPORT_SYMBOL(hci_conn_check_secure);
-
 /* Change link key */
 int hci_conn_change_link_key(struct hci_conn *conn)
 {
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 815269b..47dff20 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1067,7 +1067,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
 		old_key_type = old_key->type;
 		key = old_key;
 	} else {
-		old_key_type = conn ? conn->key_type : 0xff;
+		old_key_type = 0xff;
 		key = kzalloc(sizeof(*key), GFP_ATOMIC);
 		if (!key)
 			return -ENOMEM;
@@ -1083,8 +1083,6 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
 					(!conn || conn->remote_auth == 0xff) &&
 					old_key_type == 0xff) {
 		type = HCI_LK_COMBINATION;
-		if (conn)
-			conn->key_type = type;
 	}
 
 	bacpy(&key->bdaddr, bdaddr);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a61ca11..b57b971 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2095,7 +2095,6 @@ static inline void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff
 			goto not_found;
 		}
 
-		conn->key_type = key->type;
 		conn->pin_length = key->pin_len;
 	}
 
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 5759bb7..121a5c1 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2096,7 +2096,7 @@ static void rfcomm_security_cfm(struct hci_conn *conn, u8 status, u8 encrypt)
 		if (!test_and_clear_bit(RFCOMM_AUTH_PENDING, &d->flags))
 			continue;
 
-		if (!status && hci_conn_check_secure(conn, d->sec_level))
+		if (!status)
 			set_bit(RFCOMM_AUTH_ACCEPT, &d->flags);
 		else
 			set_bit(RFCOMM_AUTH_REJECT, &d->flags);
-- 
1.7.5.3

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2011-06-09  7:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  7:20 Keith Packard [this message]
2011-06-09  7:59 ` Regression caused by "Bluetooth: Map sec_level to link key requirements" Waldemar.Rymarkiewicz
2011-06-09  8:33   ` Johan Hedberg
2011-06-09 17:01     ` Keith Packard
2011-06-09 17:11       ` Waldemar.Rymarkiewicz
2011-06-10  5:55         ` Johan Hedberg
2011-06-10  5:58           ` Luiz Augusto von Dentz
2011-06-19 11:11             ` Keith Packard
2011-06-19 17:59               ` Johan Hedberg
2011-06-19 19:01                 ` Keith Packard
2011-06-25  5:45                   ` Jeremy Fitzhardinge
2011-06-25 19:40                     ` Gustavo F. Padovan
2011-06-09  8:02 ` Waldemar.Rymarkiewicz
2011-06-09 17:04   ` Keith Packard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yunboy7a2so.fsf@aiko.keithp.com \
    --to=keithp@keithp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=padovan@profusion.mobi \
    --cc=waldemar.rymarkiewicz@tieto.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).