Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3688185lfo; Mon, 23 May 2022 11:29:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmFxnHSysQzzEp1SBcpavmjgc8nWS34Q0C6FSw5dccrSemQ+G5pkKGXua0Pflm3qU3YPl3 X-Received: by 2002:a05:6a00:729:b0:4f7:77ed:c256 with SMTP id 9-20020a056a00072900b004f777edc256mr24827955pfm.1.1653330554411; Mon, 23 May 2022 11:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330554; cv=none; d=google.com; s=arc-20160816; b=rTB5QxqZK1Jdtyw5aAN7K/YRYGvJDPGo+lbpOpJTYGZSkV+fPz6Nsn2+yCjpfrd/z2 px47wZrBx74asHujB7F0xadeE/ZHw8xRumn4HgB9SU5dL1H+dRLxm6O5u8AZ2wiELAzv +BKOa7nIrJ0nwVxAnb5oMu56GwAcnwjBY67yPkEd2/BlW1OCC6l6QJXTn/HZ3v8qfWNP 6wdZ+itHt00yBkrtrXr/NmysyqjBouoMOLaM497xm1UJ+KeFKIV7FSeqhQ1kDjouGFF0 ddYW7likmxvCYbqRLsCe/csLbmyYbEVicNC/uGjB0Xk+vp9yW1MpYR8D2gGa+1QMbK+Q Ldjg== 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=tzSVmkWDhz8UYrR5gfBNcgthA3A7XTlKgmZYztc+36M=; b=LlogjPlshfBxOM7uV4uFE+zHpA+3S6arj5VUq9Sn0SXbT9ebCPPvqcNZcRX1Fd7Qfb S14SD3rwV3E7kLeRyqYrJGP09mYiE5W3G9HFC+8af9GH474DNKqbJtPmDCUy7CYwVulO osN5itr7pWbIs6CGno/8V5mi8KqChxjprvMp2iJNAhF3Mgkvxq+z3jNWhsY9H2Xx5FkE le1jN5RfktZ0k+1fOsy1mDwaPimD1GK5DX7g9f82MkPiCA911JCcxwJCZKy27NUbL1/F U21zkStyFUtmSPIJkbkAxEGXECz3rRoUps0DY3rVbmg0NyfYMM9+p/pC86+PHbbkIY2q rQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lLd/5otK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f6-20020a056a0022c600b005183682009fsi15422964pfj.298.2022.05.23.11.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:29:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lLd/5otK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2AB4711CB5B; Mon, 23 May 2022 11:28:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244640AbiEWSGo (ORCPT + 99 others); Mon, 23 May 2022 14:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243565AbiEWRiS (ORCPT ); Mon, 23 May 2022 13:38:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F4471D86; Mon, 23 May 2022 10:32:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40748B81204; Mon, 23 May 2022 17:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87B54C385AA; Mon, 23 May 2022 17:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653327115; bh=dgG/AjxTDAWbTv8PbOERZK7TlvSzG5giHmfTLth98NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLd/5otKO/UI1QRSFjxWvGJx52tUjGfeIGXo9EOdpIXhiiCZVaqrldrOHGHJoWvCY KkSD3JybyxbfktM3V1BM3NM7qXV/Ieo+axNGIc4VtpMJhhiIyeF7NfSHWySeDxoSdI wlBXOkh/WCWHduFAyPtMy3m3vcYfkNQVnFPb/AH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kieran Frewen , Bassem Dawood , Johannes Berg , Sasha Levin Subject: [PATCH 5.17 136/158] nl80211: validate S1G channel width Date: Mon, 23 May 2022 19:04:53 +0200 Message-Id: <20220523165852.870833198@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kieran Frewen [ Upstream commit 5d087aa759eb82b8208411913f6c2158bd85abc0 ] Validate the S1G channel width input by user to ensure it matches that of the requested channel Signed-off-by: Kieran Frewen Signed-off-by: Bassem Dawood Link: https://lore.kernel.org/r/20220420041321.3788789-2-kieran.frewen@morsemicro.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/nl80211.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index dc171ca0d1b1..06a35f1bec23 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3128,6 +3128,15 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, } else if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { chandef->width = nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); + if (chandef->chan->band == NL80211_BAND_S1GHZ) { + /* User input error for channel width doesn't match channel */ + if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) { + NL_SET_ERR_MSG_ATTR(extack, + attrs[NL80211_ATTR_CHANNEL_WIDTH], + "bad channel width"); + return -EINVAL; + } + } if (attrs[NL80211_ATTR_CENTER_FREQ1]) { chandef->center_freq1 = nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]); -- 2.35.1