From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Szymon Janc To: johan.hedberg@gmail.com Cc: linux-bluetooth@vger.kernel.org Subject: Re: [PATCH 2/7] Bluetooth: Don't take any action in smp_resume_cb if not encrypted Date: Fri, 05 Sep 2014 13:19:53 +0200 Message-ID: <2189455.GHcQgNNsdn@uw000953> In-Reply-To: <1409914266-21624-3-git-send-email-johan.hedberg@gmail.com> References: <1409914266-21624-1-git-send-email-johan.hedberg@gmail.com> <1409914266-21624-3-git-send-email-johan.hedberg@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Johan, On Friday 05 of September 2014 13:51:01 johan.hedberg@gmail.com wrote: > From: Johan Hedberg > > When smp_resume_cb is called if we're not encrypted (i.e. the callback > wasn't called because we the connection became encrypted) we shouldn't There is something wrong with this comment in brackets. > take any action at all. This patch moves also the security_timer > cancellation behind this condition. > > Signed-off-by: Johan Hedberg > --- > net/bluetooth/smp.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c > index b8ecc7bd3e3b..9accb4739488 100644 > --- a/net/bluetooth/smp.c > +++ b/net/bluetooth/smp.c > @@ -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) > -- Best regards, Szymon Janc