Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp523008pxx; Wed, 28 Oct 2020 10:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5dFqLMnTxDlDGoa48fPVxZm1XXYlXBTSanxR10NbEt4FRCclTxCpAi3a3cKMlmbkPClqZ X-Received: by 2002:a50:b224:: with SMTP id o33mr8466225edd.21.1603905270547; Wed, 28 Oct 2020 10:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603905270; cv=none; d=google.com; s=arc-20160816; b=VXGkJ9pOkOqTiXxfL1cSwvpQSEoppcj92nmWGaVxTnXGXsDyQV1NXO7rTKgFRWY52s 6zvGjP6NaZz07xLswasSSgsUAF8r2cyJkO17Z0fSxOoYe9UhUT6/c22tKLIQEe5o48rY Dtx4JGD1/MP6FoCzrdio1hndnd71YqMUR9icLRLUplRd2n3ng3pwtQN0INqngk4uuijY 74+Grak6/H+xT56KlMFp1ggHGGjr6ZAZZi7mloM+ixPoOusgbZXLAjpJufDg8WBMN9mm 7HkDDPiZkGnSG7rPTnha59kLZNtaQD07wWefn709bGDKYznMWV9Q651pU1+AYxv7t1Hk dbkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZyXGqbaL+jWAh2o56bXvS/Xy8PvDDF0ohvBp4TDU5Bg=; b=DKoTbHN4pCmqycuxv/5RzmSRw4aArRuumsG43fwZG+goMOvAKp7Evr4MwSw5PuoH7f hx4NmxnqrdJjz0H6emyxoWE4cQL5NQXyeFOkJM431YQTjy7MEbbSP10M1D7hRPTNvdz8 v4inC9S0Lap1v3zOEIMBXwhFe9cvjoZYtnYR7zd1QTiK6QO53qnOZXdRZrBjwegYi4Fn qy8V3KpglXx4VNpFzDZQEw6lxgpi58O7Yzvolmg/TIBhYyR1dOiGWlAWF7Ojyrd6zAEF dF2Czjh4sbNyc9wuq7OobfIe4ODHfHljBRsGXx2FhOpFaGWa/jxvoeflug9j4Nf2X+k6 cm1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJ4irZD6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si37501edm.38.2020.10.28.10.14.08; Wed, 28 Oct 2020 10:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJ4irZD6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1820611AbgJ0Rgk (ORCPT + 99 others); Tue, 27 Oct 2020 13:36:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760727AbgJ0OgK (ORCPT ); Tue, 27 Oct 2020 10:36:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2CC8122202; Tue, 27 Oct 2020 14:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809369; bh=QbbqUzTWaoEArM6l/W/mlEpxH7DYbkc2kfGK4tLYhus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJ4irZD6wneQfSsTpr7nN5fAi7cMgukT59KAF32Rvv2b6hsDUY+neVwTGNBeHHBl/ GYuw3zsk+8XgQTDt8+/UABVI5KxACnUDS/XNZHUoBBcS9eagCjVzaBtdz8nFS/Pg+O 7oVrlT/Tkf2XMUJ1+6kTDorDDJzg25kHF+PNf89Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajkumar Manoharan , Johannes Berg , Sasha Levin Subject: [PATCH 5.4 171/408] nl80211: fix OBSS PD min and max offset validation Date: Tue, 27 Oct 2020 14:51:49 +0100 Message-Id: <20201027135503.027458404@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajkumar Manoharan [ Upstream commit 6c8b6e4a5f745ec49286ac0a3f1d591a34818f82 ] The SRG min and max offset won't present when SRG Information Present of SR control field of Spatial Reuse Parameter Set element set to 0. Per spec. IEEE802.11ax D7.0, SRG OBSS PD Min Offset ≤ SRG OBSS PD Max Offset. Hence fix the constrain check to allow same values in both offset and also call appropriate nla_get function to read the values. Fixes: 796e90f42b7e ("cfg80211: add support for parsing OBBS_PD attributes") Signed-off-by: Rajkumar Manoharan Link: https://lore.kernel.org/r/1601278091-20313-1-git-send-email-rmanohar@codeaurora.org Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/nl80211.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7bc4f37655237..3faad3b147376 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4496,16 +4496,14 @@ static int nl80211_parse_he_obss_pd(struct nlattr *attrs, if (err) return err; - if (!tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET] || - !tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]) - return -EINVAL; - - he_obss_pd->min_offset = - nla_get_u32(tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]); - he_obss_pd->max_offset = - nla_get_u32(tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]); - - if (he_obss_pd->min_offset >= he_obss_pd->max_offset) + if (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]) + he_obss_pd->min_offset = + nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]); + if (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]) + he_obss_pd->max_offset = + nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]); + + if (he_obss_pd->min_offset > he_obss_pd->max_offset) return -EINVAL; he_obss_pd->enable = true; -- 2.25.1