]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Bluetooth: Fix old_key_type logic for non-persistent keys
authorJohan Hedberg <johan.hedberg@nokia.com>
Thu, 28 Apr 2011 18:29:00 +0000 (11:29 -0700)
committerGustavo F. Padovan <padovan@profusion.mobi>
Thu, 28 Apr 2011 19:14:41 +0000 (16:14 -0300)
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>
net/bluetooth/hci_core.c

index 5f55aef63e20085238ead692b91970b6c0584219..2ac6036b70c3d0c4161a6f0117e12a11a62904a9 100644 (file)
@@ -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;