Bluetooth: Wrong style spin lock used
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 29 Oct 2014 08:16:00 +0000 (10:16 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 29 Oct 2014 15:20:40 +0000 (16:20 +0100)
Use spin_lock_bh() as the code is called from softirq in networking subsystem.
This is needed to prevent deadlocks when 6lowpan link is in use.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c

index ddf33900f7f320b435e3b94c45db9f9246647040..91995f8ab0a0dd410bc922373376fa24054273c9 100644 (file)
@@ -4661,8 +4661,12 @@ static void hci_queue_acl(struct hci_chan *chan, struct sk_buff_head *queue,
 
                skb_shinfo(skb)->frag_list = NULL;
 
-               /* Queue all fragments atomically */
-               spin_lock(&queue->lock);
+               /* Queue all fragments atomically. We need to use spin_lock_bh
+                * here because of 6LoWPAN links, as there this function is
+                * called from softirq and using normal spin lock could cause
+                * deadlocks.
+                */
+               spin_lock_bh(&queue->lock);
 
                __skb_queue_tail(queue, skb);
 
@@ -4679,7 +4683,7 @@ static void hci_queue_acl(struct hci_chan *chan, struct sk_buff_head *queue,
                        __skb_queue_tail(queue, skb);
                } while (list);
 
-               spin_unlock(&queue->lock);
+               spin_unlock_bh(&queue->lock);
        }
 }