From cf1055773b6772908205a55adf3b9f6aee0391dd Mon Sep 17 00:00:00 2001 From: Amir Levy Date: Tue, 23 Jun 2020 17:00:16 +0300 Subject: [PATCH] ipa: fix ipa3_send_nop_desc locking before alloc After adding the tx_pkt_wrapper cache the allocation was done in GFP_KERNEL while SoftIrqs are disabled since spin_lock_bh was used. This change releases the spinlock before allocation is done. Change-Id: I3c3cee3e82d581c79a0258d3fcec378ed3d9a07c Acked-by: Tal Gelbard Signed-off-by: Amir Levy --- drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 4a243d63163c..de1fe9dc7bbb 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -313,6 +313,7 @@ static void ipa3_send_nop_desc(struct work_struct *work) IPADBG_LOW("gsi send NOP for ch: %lu\n", sys->ep->gsi_chan_hdl); if (atomic_read(&sys->workqueue_flushed)) return; + spin_lock_bh(&sys->spinlock); if (!list_empty(&sys->avail_tx_wrapper_list)) { tx_pkt = list_first_entry(&sys->avail_tx_wrapper_list, @@ -321,8 +322,10 @@ static void ipa3_send_nop_desc(struct work_struct *work) sys->avail_tx_wrapper--; memset(tx_pkt, 0, sizeof(struct ipa3_tx_pkt_wrapper)); } else { + spin_unlock_bh(&sys->spinlock); tx_pkt = kmem_cache_zalloc(ipa3_ctx->tx_pkt_wrapper_cache, GFP_KERNEL); + spin_lock_bh(&sys->spinlock); } if (!tx_pkt) { spin_unlock_bh(&sys->spinlock); @@ -358,7 +361,6 @@ static void ipa3_send_nop_desc(struct work_struct *work) /* make sure TAG process is sent before clocks are gated */ ipa3_ctx->tag_process_before_gating = true; - } @@ -566,7 +568,6 @@ int ipa3_send(struct ipa3_sys_context *sys, /* set the timer for sending the NOP descriptor */ if (send_nop) { - ktime_t time = ktime_set(0, IPA_TX_SEND_COMPL_NOP_DELAY_NS); IPADBG_LOW("scheduling timer for ch %lu\n",