brcmfmac: block the correct flowring when backup queue overflow
authorFranky Lin <frankyl@broadcom.com>
Thu, 20 Aug 2015 20:06:06 +0000 (22:06 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Aug 2015 12:32:29 +0000 (15:32 +0300)
brcmf_flowring_block blocks the last active flowring under the same
interface instead of the one provided by caller. This could lead to a
dead lock of netif stop if there are more than one flowring under the
interface and the traffic is high enough so brcmf_flowring_enqueue can
not unblock the ring right away.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/flowring.c

index 59440631fec50637fc3f35e162defb230d1f420c..8d1ab4ab5be809ca8fab1a4e37a31f1af8538391 100644 (file)
@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
        spin_lock_irqsave(&flow->block_lock, flags);
 
        ring = flow->rings[flowid];
+       if (ring->blocked == blocked) {
+               spin_unlock_irqrestore(&flow->block_lock, flags);
+               return;
+       }
        ifidx = brcmf_flowring_ifidx_get(flow, flowid);
 
        currently_blocked = false;
        for (i = 0; i < flow->nrofrings; i++) {
-               if (flow->rings[i]) {
+               if ((flow->rings[i]) && (i != flowid)) {
                        ring = flow->rings[i];
                        if ((ring->status == RING_OPEN) &&
                            (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
                        }
                }
        }
-       ring->blocked = blocked;
-       if (currently_blocked == blocked) {
+       flow->rings[flowid]->blocked = blocked;
+       if (currently_blocked) {
                spin_unlock_irqrestore(&flow->block_lock, flags);
                return;
        }