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 f6ffea8..f735c8a 100644 (file)
@@ -2170,6 +2170,11 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param)
 
        BT_DBG("%s opcode 0x%x plen %d", hdev->name, opcode, plen);
 
+       if (!hdev->workqueue) {
+               WARN_ON("hci_send_cmd: workqueue not initialised");
+               return -ENOMEM;
+       }
+
        skb = bt_skb_alloc(len, GFP_ATOMIC);
        if (!skb) {
                BT_ERR("%s no memory for command", hdev->name);