From patchwork Thu Apr 2 06:41:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 6144681 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 577639F398 for ; Thu, 2 Apr 2015 06:42:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 753FC2034C for ; Thu, 2 Apr 2015 06:42:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8083A20328 for ; Thu, 2 Apr 2015 06:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbbDBGmb (ORCPT ); Thu, 2 Apr 2015 02:42:31 -0400 Received: from mga02.intel.com ([134.134.136.20]:40007 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbbDBGm1 (ORCPT ); Thu, 2 Apr 2015 02:42:27 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 01 Apr 2015 23:42:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,509,1422950400"; d="scan'208";a="702051175" Received: from trider-mobl2.ger.corp.intel.com (HELO egrumbacBox.ger.corp.intel.com) ([10.255.199.72]) by fmsmga002.fm.intel.com with ESMTP; 01 Apr 2015 23:42:16 -0700 From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Matti Gottlieb , Emmanuel Grumbach Subject: [PATCH 24/31] iwlwifi: mvm: Fix wrongfully flushing frames in the roc/off channel queue Date: Thu, 2 Apr 2015 09:41:12 +0300 Message-Id: <1427956879-11725-24-git-send-email-emmanuel.grumbach@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427956656.8122.2.camel@egrumbacBox> References: <1427956656.8122.2.camel@egrumbacBox> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: Matti Gottlieb Sending multiple action frames off channel, one after the other can create a race that will result in a timeout: 1. Start sending action frame off channel. 2. Once the frame is sent or the time event is over, the flow will eventually call ieee80211_start_next_roc to start the next roc frame & iwl_mvm_roc_finished schedules to schedule a work to flush the queue. 3. Start sending new roc frame and write it to the queue before the flush work has started. 4. The work is called and it flushes the new packet that was placed on the on the queue so the packet is lost. This causes the frame to be removed & not sent, that causes a timeout in userspace. Flush the work queue that flushes the roc/off channel queue before starting to send a new frame off channel, in order to avoid a race between the new frame that is transmitted off channel & the flushing of the queue. Signed-off-by: Matti Gottlieb Reviewed-by: Johannes Berg Signed-off-by: Emmanuel Grumbach --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 0dd999c..0bd3373 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -3080,6 +3080,8 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, duration, type); + flush_work(&mvm->roc_done_wk); + mutex_lock(&mvm->mutex); switch (vif->type) {