Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1719504ybb; Thu, 26 Mar 2020 06:11:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvaML/XRXdd2S0KSbpZy6Y7EFrz5PQmHr/+SNeSVo+VciBAYKdMF71SsuKCGBuFPaI7he5C X-Received: by 2002:a9d:6e05:: with SMTP id e5mr6025128otr.277.1585228266194; Thu, 26 Mar 2020 06:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585228266; cv=none; d=google.com; s=arc-20160816; b=pbeDhGzZFevAdJ4pA5Yw5qCCQY/bQ5sqspW48S6UpMKbm7l/48eGvnJ8nqRFg5sZpI rFeX/zXwMDj4lU2k1hc0rA2vPXB5w2Ofp7avW3He55DUF9cq0cXjddepCFZCjq0Sub02 8vonMC/xcyLP+lQeFXmr4IKBYO18OKpcmBBvSkgsjWCekRT+oV4PcYR8O6AZBCCgk6vy y5YooBq3ZEi/TtLDxM6hSMam2j+0RpqCXh9q8fNyIek19A77SDvSrYjaRctkWnCdta14 Jcdb3YdFKlaXolIOMwZJIp0eJ0kWrpsbu5zxZdbxmWzplV3lWzm8yyf9jWL8+ZNUPJA5 lkVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=Ch0hJZ5t6oRwRO2HLe9HfBsOEXNAQZG89iGN5HCziuc=; b=dnQvXROheIUINFBFhRrKDTINP8PEIf7y+T7xqkIPO4v1HKa4kRT/QDs3AkwLbJPc40 0zH7m7nWRxhubdauIAanQzP0KoqZcRQ0VxJwyMW4+RNN9wiA80ZxWRamzEgjnYvkwEi9 QphvPycM+BOFof8Ayqwh2PJd4MyAXomokKBTfA9zigIQpPmQrN9U1LJReSF1jIM+Qs7L LbWXTcj1wwdu+bmmPr3En7ysmPntRpKPRRzxpwnsOAhTwyq2QiHALgoCk0xzIddcSOSe wZhCi/b/h8z4nTIVGTKU3x9VQJXEhiXTN02BDlCl/aNrExgPmz+hQpolaNHbgjyHQdOY 2tCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si1092983otp.268.2020.03.26.06.10.42; Thu, 26 Mar 2020 06:11:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbgCZNKC (ORCPT + 99 others); Thu, 26 Mar 2020 09:10:02 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44360 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727752AbgCZNKB (ORCPT ); Thu, 26 Mar 2020 09:10:01 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jHSGl-00044K-AG; Thu, 26 Mar 2020 15:09:59 +0200 From: Luca Coelho To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Date: Thu, 26 Mar 2020 15:09:39 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200326130943.623208-1-luca@coelho.fi> References: <20200326130943.623208-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH v2 08/12] mac80211: Fail association when AP has no legacy rates Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ilan Peer The MLME logic had a workaround that allowed to continue an association with an AP even if the AP did not provide any basic rates in its supported rates in the association response, assuming that the first (non basic) legacy rate could be used as a basic rate. However, this did not consider the case where the AP (which is obviously buggy) did not provide any legacy rate. Fix this by failing the association, as this can result in an unexpected failure in the low level driver and FW, e.g., in rate scale logic etc. Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho --- net/mac80211/mlme.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 04ed883339c7..2b57c53ab070 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5037,8 +5037,16 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, * doesn't happen any more, but keep the workaround so * in case some *other* APs are buggy in different ways * we can connect -- with a warning. + * Allow this workaround only in case the AP provided at least + * one rate. */ - if (!basic_rates && min_rate_index >= 0) { + if (min_rate_index < 0) { + sdata_info(sdata, + "No legacy rates in association response\n"); + + sta_info_free(local, new_sta); + return -EINVAL; + } else if (!basic_rates) { sdata_info(sdata, "No basic rates, using min rate instead\n"); basic_rates = BIT(min_rate_index); -- 2.25.1