From: Johan Hedberg Date: Thu, 28 Apr 2011 18:29:00 +0000 (-0700) Subject: Bluetooth: Fix old_key_type logic for non-persistent keys X-Git-Tag: upstream/snapshot3+hdmi~9986^2~16^2~94^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12adcf3a953c3aa4006d855aa638133bf018ceac;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 5f55aef..2ac6036 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;