Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4748735f authored by Dundi Raviteja's avatar Dundi Raviteja
Browse files

wlan: use irq API's to acquire spin lock

data_queue_lock is called in interrupt context and thread context,
there can be a spinlock recursion if thread context acquires lock
first and then interrupt context tries to acquire lock.

To address this use irq API's spin_lock_irq() and spin_unlock_irq().

Change-Id: I3a7874c6da3003d8a93b9180c8968fe18719abc5
CRs-Fixed: 2770174
parent 845e965d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -242,16 +242,19 @@ WCTS_PALReadCallback
   /* iterate until no more packets are available */
   while (1) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
      spin_lock(&pWCTSCb->wctsDataMsg.data_queue_lock);
      unsigned long flags;

      spin_lock_irqsave(&pWCTSCb->wctsDataMsg.data_queue_lock, flags);
      if (list_empty(&pWCTSCb->wctsDataMsg.data_queue)) {
	      spin_unlock(&pWCTSCb->wctsDataMsg.data_queue_lock);
	      spin_unlock_irqrestore(&pWCTSCb->wctsDataMsg.data_queue_lock,
                                     flags);
	      return;
      }

      msg = list_first_entry(&pWCTSCb->wctsDataMsg.data_queue,
                             struct data_msg, list);
      spin_unlock_irqrestore(&pWCTSCb->wctsDataMsg.data_queue_lock, flags);
      list_del(&msg->list);
      spin_unlock(&pWCTSCb->wctsDataMsg.data_queue_lock);

      buffer = msg->buffer;
      packet_size = msg->buf_len;