From patchwork Sun Nov 15 11:33:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Buesch X-Patchwork-Id: 60106 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAFBXkgV028533 for ; Sun, 15 Nov 2009 11:33:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752098AbZKOLdh (ORCPT ); Sun, 15 Nov 2009 06:33:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751969AbZKOLdg (ORCPT ); Sun, 15 Nov 2009 06:33:36 -0500 Received: from bu3sch.de ([62.75.166.246]:34335 "EHLO vs166246.vserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbZKOLdg (ORCPT ); Sun, 15 Nov 2009 06:33:36 -0500 Received: by vs166246.vserver.de with esmtpa (Exim 4.69) id 1N9dMS-0008HJ-GE; Sun, 15 Nov 2009 11:33:40 +0000 From: Michael Buesch To: stable@kernel.org Subject: [PATCH stable] b43: Work around mac80211 race condition Date: Sun, 15 Nov 2009 12:33:08 +0100 User-Agent: KMail/1.9.9 Cc: bcm43xx-dev@lists.berlios.de, linux-wireless@vger.kernel.org, Larry Finger X-Move-Along: Nothing to see here. No, really... Nothing. MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200911151233.10530.mb@bu3sch.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 7964cc3..41a0e9c 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -1334,13 +1334,22 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) spin_lock_irqsave(&ring->lock, flags); B43_WARN_ON(!ring->tx); - /* Check if the queue was stopped in mac80211, - * but we got called nevertheless. - * That would be a mac80211 bug. */ - B43_WARN_ON(ring->stopped); - if (unlikely(free_slots(ring) < TX_SLOTS_PER_FRAME)) { - b43warn(dev->wl, "DMA queue overflow\n"); + if (unlikely(ring->stopped)) { + /* We get here only because of a bug in mac80211. + * Because of a race, one packet may be queued after + * the queue is stopped, thus we got called when we shouldn't. + * For now, just refuse the transmit. */ + if (b43_debug(dev, B43_DBG_DMAVERBOSE)) + b43err(dev->wl, "Packet after queue stopped\n"); + err = -ENOSPC; + goto out_unlock; + } + + if (unlikely(WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME))) { + /* If we get here, we have a real error with the queue + * full, but queues not stopped. */ + b43err(dev->wl, "DMA queue overflow\n"); err = -ENOSPC; goto out_unlock; }