diff options
| author | Andrei Danaila <adanaila@codeaurora.org> | 2014-09-12 14:38:12 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:10:55 -0700 |
| commit | 7cabb2be253cf2594c53d861f17e7565652c6dbe (patch) | |
| tree | ac4a479fa96f0fab2f0c21a136bde06ea7b24e19 | |
| parent | c17dca1d42e6ed108c09068fbbed0ffff50e498b (diff) | |
msm: mhi: Prevent IRQ mask race condition in MHI
Fixed a race condition in MHI RmNet where the RX interrupt
could remain masked forever.
CRs-Fixed: 723355
Change-Id: I9606963b8b2d6d1cb125c0bc7be8610b06f67be3
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
| -rw-r--r-- | drivers/net/ethernet/msm/msm_rmnet_mhi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/msm/msm_rmnet_mhi.c b/drivers/net/ethernet/msm/msm_rmnet_mhi.c index 5dce765663d3..175d0e71f884 100644 --- a/drivers/net/ethernet/msm/msm_rmnet_mhi.c +++ b/drivers/net/ethernet/msm/msm_rmnet_mhi.c @@ -125,7 +125,7 @@ struct rmnet_mhi_private { u32 rx_enabled; u32 mhi_enabled; struct net_device *dev; - int32_t irq_masked_cntr; + atomic_t irq_masked_cntr; rwlock_t out_chan_full_lock; }; @@ -310,9 +310,9 @@ static int rmnet_mhi_poll(struct napi_struct *napi, int budget) /* We got a NULL descriptor back */ if (should_reschedule == false) { - if (rmnet_mhi_ptr->irq_masked_cntr) { + if (atomic_read(&rmnet_mhi_ptr->irq_masked_cntr)) { + atomic_dec(&rmnet_mhi_ptr->irq_masked_cntr); mhi_unmask_irq(rmnet_mhi_ptr->rx_client_handle); - --rmnet_mhi_ptr->irq_masked_cntr; } } else { if (received_packets == budget) @@ -497,7 +497,7 @@ static void rmnet_mhi_rx_cb(struct mhi_result *result) if (napi_schedule_prep(&(rmnet_mhi_ptr->napi))) { mhi_mask_irq(rmnet_mhi_ptr->rx_client_handle); - rmnet_mhi_ptr->irq_masked_cntr++; + atomic_inc(&rmnet_mhi_ptr->irq_masked_cntr); __napi_schedule(&(rmnet_mhi_ptr->napi)); } else { rx_interrupts_in_masked_irq[rmnet_mhi_ptr->dev_index]++; @@ -539,9 +539,9 @@ static int rmnet_mhi_close(struct net_device *dev) rmnet_mhi_ptr->mhi_enabled = 0; rmnet_mhi_disable_iface(rmnet_mhi_ptr); napi_disable(&(rmnet_mhi_ptr->napi)); - if (rmnet_mhi_ptr->irq_masked_cntr) { + if (atomic_read(&rmnet_mhi_ptr->irq_masked_cntr)) { + atomic_dec(&rmnet_mhi_ptr->irq_masked_cntr); mhi_unmask_irq(rmnet_mhi_ptr->rx_client_handle); - --rmnet_mhi_ptr->irq_masked_cntr; } return 0; } |
