Bluetooth: Don't take any action in smp_resume_cb if not encrypted
authorJohan Hedberg <johan.hedberg@intel.com>
Fri, 5 Sep 2014 19:19:49 +0000 (22:19 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 8 Sep 2014 17:07:55 +0000 (19:07 +0200)
When smp_resume_cb is called if we're not encrypted (i.e. the callback
wasn't called because the connection became encrypted) we shouldn't take
any action at all. This patch moves also the security_timer cancellation
behind this condition.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/smp.c

index b8ecc7bd3e3b710462ab8c3606d2b6d3efdac13c..9accb47394882d44d849a452b4f96875451f3a6a 100644 (file)
@@ -1533,10 +1533,12 @@ static void smp_resume_cb(struct l2cap_chan *chan)
        if (!smp)
                return;
 
+       if (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags))
+               return;
+
        cancel_delayed_work(&smp->security_timer);
 
-       if (test_bit(HCI_CONN_ENCRYPT, &hcon->flags))
-               queue_work(hdev->workqueue, &smp->distribute_work);
+       queue_work(hdev->workqueue, &smp->distribute_work);
 }
 
 static void smp_ready_cb(struct l2cap_chan *chan)