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

Commit ba8a674f authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Gerrit - the friendly Code Review server
Browse files

driver: soc: bam_dmux: Fix spinlock lock-up



Client invoking the BAM DMUX function from callback notifier and
calling the callback notifier by acquiring channel spinlock triggers
spinlock lock-up.

Remove the notifier callback from the spinlock context.

CRs-Fixed: 780192
Change-Id: Ic01c4d605510a68624dd9a14c35927892f1721d1
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent 4a67ea65
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -528,6 +528,8 @@ static void bam_mux_process_data(struct sk_buff *rx_skb)
	struct bam_mux_hdr *rx_hdr;
	unsigned long event_data;
	uint8_t ch_id;
	void (*notify)(void *, int, unsigned long);
	void *priv;

	rx_hdr = (struct bam_mux_hdr *)rx_skb->data;
	ch_id = rx_hdr->ch_id;
@@ -540,15 +542,19 @@ static void bam_mux_process_data(struct sk_buff *rx_skb)
	rx_skb->truesize = rx_hdr->pkt_len + sizeof(struct sk_buff);

	event_data = (unsigned long)(rx_skb);
	notify = NULL;
	priv = NULL;

	spin_lock_irqsave(&bam_ch[ch_id].lock, flags);
	if (bam_ch[ch_id].notify)
		bam_ch[ch_id].notify(
			bam_ch[ch_id].priv, BAM_DMUX_RECEIVE,
							event_data);
	if (bam_ch[ch_id].notify) {
		notify = bam_ch[ch_id].notify;
		priv = bam_ch[ch_id].priv;
	}
	spin_unlock_irqrestore(&bam_ch[ch_id].lock, flags);
	if (notify)
		notify(priv, BAM_DMUX_RECEIVE, event_data);
	else
		dev_kfree_skb_any(rx_skb);
	spin_unlock_irqrestore(&bam_ch[ch_id].lock, flags);

	queue_rx();
}