summaryrefslogtreecommitdiff
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2011-04-28 22:29:00 +0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-04-28 23:14:41 +0400
commit12adcf3a953c3aa4006d855aa638133bf018ceac (patch)
treef39d0e208c172f3956e7e59874091bee9c361488 /net/bluetooth
parentd25e28abe58d2bcedf6025a6ccc532c29a19046f (diff)
downloadlinux-12adcf3a953c3aa4006d855aa638133bf018ceac.tar.xz
Bluetooth: Fix old_key_type logic for non-persistent keys
Even if there's no previous key stored the connection might still be secured with a non-persistent key and in that case the key type in the hci_conn struct should be checked. Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 5f55aef63e20..2ac6036b70c3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1069,7 +1069,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 = 0xff;
+ old_key_type = conn ? conn->key_type : 0xff;
key = kzalloc(sizeof(*key), GFP_ATOMIC);
if (!key)
return -ENOMEM;