From patchwork Wed Feb 24 15:25:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 8409011 X-Patchwork-Delegate: johannes@sipsolutions.net 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B892C0553 for ; Wed, 24 Feb 2016 15:26:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58DD32010C for ; Wed, 24 Feb 2016 15:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D41320131 for ; Wed, 24 Feb 2016 15:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754626AbcBXP0i (ORCPT ); Wed, 24 Feb 2016 10:26:38 -0500 Received: from narfation.org ([79.140.41.39]:41114 "EHLO v3-1039.vlinux.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbcBXP0h (ORCPT ); Wed, 24 Feb 2016 10:26:37 -0500 Received: from sven-desktop.home.narfation.org (x5d84b878.dyn.telefonica.de [93.132.184.120]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 58A0E1C8001; Wed, 24 Feb 2016 16:26:36 +0100 (CET) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=20121; t=1456327596; bh=rbMHvnEwyhZBixug5Gd7BlaDrwRGRv9M2Igj6eev54w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MT5On1SeD3d3y7hQzxOSxRDpeaEtHx0uyoq4/EY36YEdVPc8LF1r6Bn43VDYG64oP 5JVm4Ui4bed4Tc5xHz20l4baA+r/32nLI856zbvPMFKntblQnWibw5v+AD6usl5ToL bUm6wCBJdAVQuyTWZ2VblciF2PhZLAJX+/sgg/0k= From: Sven Eckelmann To: linux-wireless Cc: Lorenzo Bianconi , Johannes Berg , Sven Eckelmann Subject: [PATCH 2/2] mac80211: fix parsing of 40Mhz in injected radiotap header Date: Wed, 24 Feb 2016 16:25:49 +0100 Message-Id: <1456327549-31765-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456327549-31765-1-git-send-email-sven@narfation.org> References: <1456327549-31765-1-git-send-email-sven@narfation.org> 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.0 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2 bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be confused with IEEE80211_RADIOTAP_MCS_BW_20U. Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames") Signed-off-by: Sven Eckelmann --- net/mac80211/tx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 3a7475f..60c26a5 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1691,7 +1691,7 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local, bool rate_found = false; u8 rate_retries = 0; u16 rate_flags = 0; - u8 mcs_known, mcs_flags; + u8 mcs_known, mcs_flags, mcs_bw; int i; info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | @@ -1767,8 +1767,9 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local, mcs_flags & IEEE80211_RADIOTAP_MCS_SGI) rate_flags |= IEEE80211_TX_RC_SHORT_GI; + mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK; if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW && - mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40) + mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40) rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; break;