@@ -347,11 +347,13 @@ static int bcsp_flush(struct hci_uart *hu)
/* Remove ack'ed packets */
static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
{
+ struct sk_buff_head free_list;
struct sk_buff *skb, *tmp;
unsigned long flags;
int i, pkts_to_be_removed;
u8 seqno;
+ skb_queue_head_init(&free_list);
spin_lock_irqsave(&bcsp->unack.lock, flags);
pkts_to_be_removed = skb_queue_len(&bcsp->unack);
@@ -378,7 +380,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
i++;
__skb_unlink(skb, &bcsp->unack);
- kfree_skb(skb);
+ __skb_queue_tail(&free_list, skb);
}
if (skb_queue_empty(&bcsp->unack))
@@ -386,6 +388,8 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
+ __skb_queue_purge(&free_list);
+
if (i != pkts_to_be_removed)
BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
}
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So add all skb to a free list, then free them after spin_unlock_irqrestore() at once. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/bluetooth/hci_bcsp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)