diff options
author | Loic Poulain <loic.poulain@linaro.org> | 2021-04-20 11:36:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-04-20 17:13:43 -0700 |
commit | a926c025d56bb1acd8a192fca0e307331ee91b30 (patch) | |
tree | 936f2cc2025146353947b48270a4ea117bd6cdfc | |
parent | 8f7e876273e294b732b42af2e5e6bba91d798954 (diff) | |
download | linux-stable-a926c025d56bb1acd8a192fca0e307331ee91b30.tar.gz linux-stable-a926c025d56bb1acd8a192fca0e307331ee91b30.tar.bz2 linux-stable-a926c025d56bb1acd8a192fca0e307331ee91b30.zip |
net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation
The mhi_wwan_rx_budget_dec function is supposed to return true if
RX buffer budget has been successfully decremented, allowing to queue
a new RX buffer for transfer. However the current implementation is
broken when RX budget is '1', in which case budget is decremented but
false is returned, preventing to requeue one buffer, and leading to
RX buffer starvation.
Fixes: fa588eba632d ("net: Add Qcom WWAN control driver")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wwan/mhi_wwan_ctrl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wwan/mhi_wwan_ctrl.c b/drivers/net/wwan/mhi_wwan_ctrl.c index 416ae6abafb7..1bc6b69aa530 100644 --- a/drivers/net/wwan/mhi_wwan_ctrl.c +++ b/drivers/net/wwan/mhi_wwan_ctrl.c @@ -58,11 +58,11 @@ static bool mhi_wwan_rx_budget_dec(struct mhi_wwan_dev *mhiwwan) spin_lock(&mhiwwan->rx_lock); - if (mhiwwan->rx_budget) + if (mhiwwan->rx_budget) { mhiwwan->rx_budget--; - - if (mhiwwan->rx_budget && test_bit(MHI_WWAN_RX_REFILL, &mhiwwan->flags)) - ret = true; + if (test_bit(MHI_WWAN_RX_REFILL, &mhiwwan->flags)) + ret = true; + } spin_unlock(&mhiwwan->rx_lock); |