net: bluetooth: check if workqueue handle is valid before use
Varun Wadekar [Mon, 21 May 2012 13:00:35 +0000 (18:00 +0530)]
Change-Id: Ia93a3489669ec762cdaf84c558672320da378e17
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

net/bluetooth/hci_core.c

index 29297a1..ddb320f 100644 (file)
@@ -2672,6 +2672,11 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
 
        BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen);
 
+       if (!hdev->workqueue) {
+               WARN_ON("hci_send_cmd: workqueue not initialised");
+               return -ENOMEM;
+       }
+
        skb = hci_prepare_cmd(hdev, opcode, plen, param);
        if (!skb) {
                BT_ERR("%s no memory for command", hdev->name);