From patchwork Mon Oct 13 12:34:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 5075651 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 991C89F387 for ; Mon, 13 Oct 2014 12:35:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C82B5201F7 for ; Mon, 13 Oct 2014 12:35:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF30F20138 for ; Mon, 13 Oct 2014 12:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753741AbaJMMfR (ORCPT ); Mon, 13 Oct 2014 08:35:17 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:35340 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753399AbaJMMfQ (ORCPT ); Mon, 13 Oct 2014 08:35:16 -0400 Received: by mail-wg0-f42.google.com with SMTP id z12so8412379wgg.13 for ; Mon, 13 Oct 2014 05:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ljZ6D5idDizP5amxzqvCjFMjBpGkXaf2g16MAZVk2eo=; b=O+LSUU4ZP+30B0QIEVtjmqaVjXn0Zl2D+kYOcceSyPSUvjQDf3kgbHgsTFdDLrVgzb QzB8+XenlvdPHDfwUrXyO8z8JvgGvqe4mw3oMxLEy7lXqap76fBVss2sqpJf7MejPO9i x2fa0827QTCQIiT99hXOrscBx40l3+/Qc4l8/aoW/umAi2jQFYN4O/YuTWE8Xt7yYdqK f5HoEt/bLcJCISfuvYntU8/Q+hOS1f62SRvQKNfGheu45LRHpILqDLqsYxuIcUOhlFDC dCCwaKTOc0e89awSw5s7q5XsxGZKNaYuGxmX3tHRAuHhHp9Oe/YnkmpgIN53pYgyELzG a9JQ== X-Received: by 10.194.3.42 with SMTP id 10mr2332175wjz.98.1413203714816; Mon, 13 Oct 2014 05:35:14 -0700 (PDT) Received: from magnum.frso.rivierawaves.com (ppp-seco11pa2-46-193-143-43.wb.wifirst.net. [46.193.143.43]) by mx.google.com with ESMTPSA id fm10sm4381106wib.21.2014.10.13.05.35.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 05:35:13 -0700 (PDT) From: Karl Beldan To: Johannes Berg Cc: linux-wireless , Karl Beldan , Karl Beldan , stable@vger.kernel.org Subject: [PATCH v2] mac80211: fix typo in starting baserate for rts_cts_rate_idx Date: Mon, 13 Oct 2014 14:34:41 +0200 Message-Id: <1413203681-13846-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1413193692-30521-1-git-send-email-karl.beldan@gmail.com> References: <1413193692-30521-1-git-send-email-karl.beldan@gmail.com> 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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: Karl Beldan It affects non-(V)HT rates and can lead to selecting an rts_cts rate that is not a basic rate or way superior to the reference rate (ATM rates[0] used for the 1st attempt of the protected frame data). E.g, assuming drivers register growing (bitrate) sorted tables of ieee80211_rate-s, having : - rates[0].idx == d'2 and basic_rates == b'10100 will select rts_cts idx b'10011 & ~d'(BIT(2)-1), i.e. 1, likewise - rates[0].idx == d'2 and basic_rates == b'10001 will select rts_cts idx b'10000 The first is not a basic rate and the second is > rates[0]. Also, wrt severity of the addressed misbehavior, ATM we only have one rts_cts_rate_idx rather than one per rate table entry, so this idx might still point to bitrates > rates[1..MAX_RATES]. Fixes: 5253ffb8c9e1 ("mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates") Cc: stable@vger.kernel.org Signed-off-by: Karl Beldan --- net/mac80211/rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 8fdadfd..6081329 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct ieee80211_vif *vif, */ if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { u32 basic_rates = vif->bss_conf.basic_rates; - s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0; + s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0; rate = &sband->bitrates[rates[0].idx];