Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12adcf3a authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan
Browse files

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: default avatarJohan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent d25e28ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;