From f5bca8217527de3ed983906bc0f7028dcadb9f03 Mon Sep 17 00:00:00 2001 From: Brian Gix Date: Sat, 14 Jan 2012 20:21:55 -0800 Subject: [PATCH] Bluetooth: prevent dup DISCOVERY_STOP's pending It is possible to redundently request Discovery operations. This fix cleans up some stored state to prevent MGMT event overload when discovery finally completes. Change-Id: I2ffb5c0749df95e40cd39e8c64c87a62a93fb896 CRs-fixed: 329657 Signed-off-by: Brian Gix --- net/bluetooth/mgmt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 74b1d2d930d..2e4c47a70a7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -2040,10 +2040,13 @@ static int start_discovery(struct sock *sk, u16 index) if (err < 0) mgmt_pending_remove(cmd); else if (lmp_le_capable(hdev)) { + cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, index); + if (!cmd) + mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, index, + NULL, 0); hdev->disco_int_phase = 1; hdev->disco_int_count = 0; hdev->disco_state = SCAN_BR; - mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, index, NULL, 0); del_timer(&hdev->disco_le_timer); del_timer(&hdev->disco_timer); mod_timer(&hdev->disco_timer,