From 91b11ffac9591b66f5ba2dd92875f8a7585b7eee Mon Sep 17 00:00:00 2001 From: Anantha Krishnan Date: Sun, 27 Jan 2013 18:20:20 +0530 Subject: [PATCH] Bluetooth: Validate HCI device handle before updating scan state Check if the HCI device handle is available prior to updating the scan state. Change-Id: Ifc278afecbcf2bc7a95bb6595028dd890a8b60f5 CRs-Fixed: 436733 Signed-off-by: Anantha Krishnan --- net/bluetooth/mgmt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index dc6281e68cd..a1f2955cd1c 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1,7 +1,7 @@ /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2010 Nokia Corporation - Copyright (c) 2011-2012 The Linux Foundation. All rights reserved. + Copyright (c) 2011-2013 The Linux Foundation. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -2238,10 +2238,11 @@ void mgmt_inquiry_complete_evt(u16 index, u8 status) mgmt_event(MGMT_EV_DISCOVERING, index, &cp, sizeof(cp), NULL); - hdev->disco_state = SCAN_IDLE; - - if (hdev) + if (hdev) { + BT_DBG("Setting state to SCAN_IDLE\n"); + hdev->disco_state = SCAN_IDLE; goto done; + } else return; }