浏览代码

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>
Johan Hedberg 14 年之前
父节点
当前提交
12adcf3a95
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/bluetooth/hci_core.c

+ 1 - 1
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;
 		old_key_type = old_key->type;
 		key = old_key;
 		key = old_key;
 	} else {
 	} else {
-		old_key_type = 0xff;
+		old_key_type = conn ? conn->key_type : 0xff;
 		key = kzalloc(sizeof(*key), GFP_ATOMIC);
 		key = kzalloc(sizeof(*key), GFP_ATOMIC);
 		if (!key)
 		if (!key)
 			return -ENOMEM;
 			return -ENOMEM;