From patchwork Thu Apr 17 00:42:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 4005141 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD7E1BFF02 for ; Thu, 17 Apr 2014 00:43:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEAE6202B4 for ; Thu, 17 Apr 2014 00:43:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 698752028D for ; Thu, 17 Apr 2014 00:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756824AbaDQAn2 (ORCPT ); Wed, 16 Apr 2014 20:43:28 -0400 Received: from mail.candelatech.com ([208.74.158.172]:38422 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756787AbaDQAn2 (ORCPT ); Wed, 16 Apr 2014 20:43:28 -0400 Received: from ben-dt2.candelatech.com (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id s3H0grpi012771 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Apr 2014 17:42:55 -0700 From: greearb@candelatech.com To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Ben Greear Subject: [PATCH] ath10k: Hold tx-lock while detaching htt. Date: Wed, 16 Apr 2014 17:42:37 -0700 Message-Id: <1397695357-14028-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear And check for null pool in the tx path (which would indicate we are detaching). Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/htt_tx.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 22a4542..0698d6f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -143,10 +143,19 @@ static void ath10k_htt_tx_cleanup_pending(struct ath10k_htt *htt) void ath10k_htt_tx_detach(struct ath10k_htt *htt) { + struct dma_pool *tx_pool_tmp; + ath10k_htt_tx_cleanup_pending(htt); + + spin_lock_bh(&htt->tx_lock); kfree(htt->pending_tx); kfree(htt->used_msdu_ids); - dma_pool_destroy(htt->tx_pool); + tx_pool_tmp = htt->tx_pool; + htt->tx_pool = NULL; + spin_unlock_bh(&htt->tx_lock); + + dma_pool_destroy(tx_pool_tmp); + return; } @@ -403,6 +412,13 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) goto err; spin_lock_bh(&htt->tx_lock); + + /* Check if we are detached... */ + if (! htt->tx_pool) { + spin_unlock_bh(&htt->tx_lock); + goto err_tx_dec; + } + res = ath10k_htt_tx_alloc_msdu_id(htt); if (res < 0) { spin_unlock_bh(&htt->tx_lock);