Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp277972pxx; Wed, 28 Oct 2020 04:50:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN6ZiQ1JtY0+spWQpTaQYXZJXfUMv5Ftvz1m5QmsVjaF6b27FZ3iDvorHQmKwA+lihkHGZ X-Received: by 2002:a17:906:c43:: with SMTP id t3mr6977692ejf.219.1603885826526; Wed, 28 Oct 2020 04:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885826; cv=none; d=google.com; s=arc-20160816; b=gs1ST6/R6jAN7OAQFGxfvJSV2C741zCQlmEcom3KuQFVqdPyJhyev5lYwMDzec7+16 FDRbpBlAT36KdMAydncEUEi/6zIbVQiXmMg1o1nh8bcQund8UYxfiv40rsUFXOaik3vz 69aiqoHZGASc8bzCG+1Bjc2hReAXTdSb9e+P+bL2AmGzuZQ9DMVSHSUKuBTiykO0J5RH W/sqUhTm0SxRSyKnsVqy8L6l9Wqb4Ca4oAnBjZ/8ungNAY9K9Qm5AZlGRJNqfHGIkBvQ Wa4yG+8iXNGOBeW1Tb+chucpgdfNNnnGLGKzV5JYZSVyP5hd+e+Hkpo8n7lEn5/sghMR Be/g== 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=NX+BPcuXY4PQc4PylDaHt8FPgH+O6Zd6r3nggaqJV0I=; b=I0xO0Q9Hs2Y0irjL/ABeUC6ub0ZNol8wa2IHfMRAnuoQx98ZUKydzTaVZ5ECEzVUxn Gk/5AmwGlMp/53A+/Bay95B2gLpz1CIXO+IP0LqA2XGvxrOhBf+bu2C7FNsKrWIMZ0eI udF9YM1XnhIhkULRrOJCIQ4tkQB75EVN+s/cUW9lHp624atuAKE3Eedf+SBisZhgC89W ZOsRIMo1Um0LoQThYw9UWQ8apKli+r0ntOCOzU3mprWvlxl724BQt1WCxBj/XfBJvgv3 z6Y9G1/3udGcHXMvbXi2IT+F38azwD5OWh2PgV1JxLbty6xyHwDd0ocBmpgv37ANybER 87Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ka/Zjri6"; 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 p90si2749641edd.284.2020.10.28.04.50.04; Wed, 28 Oct 2020 04:50:26 -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="ka/Zjri6"; 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 S1794536AbgJ0PMR (ORCPT + 99 others); Tue, 27 Oct 2020 11:12:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:34544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762585AbgJ0PAx (ORCPT ); Tue, 27 Oct 2020 11:00:53 -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 49D8220714; Tue, 27 Oct 2020 15:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810851; bh=DDF0I1k5C+unUaX+r+5FEtnY69aKSSDIEB+xmGaIxPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ka/Zjri62s0Z3k9VoluRfmN16GT6/UgADrvcNnYe9FQc7mBxUDyoZ0xPCkZ9OnMqB VjSf9hgC0xxE859pYeShmlLMc7XL2dZCPI9/iKP8jCjsZp5LHDAjFJs+VL0qG3eytS y6zWMgFOJvfjLYFTEEHPKSWUiR1V8guoiAEctHPA= 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.8 278/633] nl80211: fix OBSS PD min and max offset validation Date: Tue, 27 Oct 2020 14:50:21 +0100 Message-Id: <20201027135535.712418669@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 4d7b255067225..7cbb94b4d4917 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4683,16 +4683,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