Thread (267 messages) 267 messages, 5 authors, 2012-09-27

Re: [RFCv2 02/20] Bluetooth: Process HCI callbacks in a workqueue

From: Andrei Emeltchenko <hidden>
Date: 2012-07-24 13:46:41

Hi Oliver,

On Tue, Jul 24, 2012 at 03:31:37PM +0200, Oliver Neukum wrote:
On Tuesday 24 July 2012 16:21:43 Andrei Emeltchenko wrote:
quoted
+void hci_queue_cb(struct hci_dev *hdev, struct hci_cb_cmd *cmd,
+                 struct workqueue_struct *workqueue)
+{
+       struct hci_cb_work *work;
+
+       BT_DBG("%s queue cmd %p", hdev->name, cmd);
+
+       work = kmalloc(sizeof(*work), GFP_KERNEL);
This looks like prone to deadlocks. You can run networked file
systems over the link and allocating memory with GFP_KERNEL
could run into a recursion problem.
Sorry, how this might run into recursion problem?

Best regards 
Andrei Emeltchenko 
quoted
+       if (!work)
+               return;
+
+       INIT_WORK(&work->work, hci_cb_worker);
+       work->hdev = hdev;
+       work->cmd = cmd;
+       hci_dev_hold(hdev);
+
+       if (!queue_work(workqueue, &work->work)) {
+               kfree(work);
+               hci_dev_put(hdev);
+       }
+}
	Regards
		Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help