Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3275960lqo; Wed, 15 May 2024 05:16:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+CLA8cUDBl8OZTHYgVe17L77AqpNrUoopHUFiMS5ri2nlXf503jZR5w9/bqHf2oOmQOXP7EbdW39qn3+f7htEQ761SxK10DLtGtsUeA== X-Google-Smtp-Source: AGHT+IEe7Lo8utnbq2Mo5G1duIHiZSNxxEnvAdwBxOa5vLBK+5vYwbjVuKlpeUKYpsbTC7ApeIfe X-Received: by 2002:a17:906:da8d:b0:a58:ea85:9114 with SMTP id a640c23a62f3a-a5a2d672fb6mr1264453266b.50.1715775372297; Wed, 15 May 2024 05:16:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715775372; cv=pass; d=google.com; s=arc-20160816; b=K7e29qbZpk3ENSCmwvMUEm/GiuwkOUzxOZtoPhjvfF4KW2dpiIMolhUG+LE0Bjogbi XndfjrOmsqEkcaVdp+b2KjoZvMW8JXssBz1l0Kf/q6EIb2Jg+a0oXxKDGjk24qU3Xspg TjbLtikn0+mLFUqjrL4Tnj9oik7YxDJPaK5K8feC0/D1eYPxyOJSGnydpXP9V2eJSxcQ 5EOL2oLq4PUeGrzOYXgL4WzCVYZXjQBQeRIIVl1bB/bC68YM1tZrxxdCLBC5qOXsoomn UcESVV9VwHPAIcLSPAIa9XKrxIqvnQbW7qqUT2Vl2gu+CC9Duk1lEliYNI7c8Kemuz59 4ZOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=fkuhbwjfpmhiKKeaZ7lZ91SaVCGdFoO3hkLfDGnNvfE=; fh=lwl+JWT6evet07cCcEr4vfRpe8zTyxktudns3YplmCg=; b=e3x4d4w0Swf5Q6d2LiTAC8fBNU2jDBlhPOsP9nBiM3lx6g0wc34Pqu5iy5gN3XBV1W s5AfvrgytrTm+3tlg4uPOw+V3iG2pSDOtXro+pkU4zTJeM8Ap69x2jg2ijqhEWAKxPXK ufPDYTgVK0k5fAMauObi2vQqDBNKjdjjIjQJmJL+ap7/7XUWEB0CNzTTN3NBQOrooHb3 xa4BCJshWg9uv2ru8ck5Hm06RnPFNp6saXzFChKI1o168lbDR1JECXcUO/QkZWHol+Sw BJWivWYKofhg48GkjLcmt4aiYB4JX0rNILVU7UBBexHi5SuVDjM41jOmgkZYpDX6CTEL E0XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=D7k2cVhb; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-7685-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7685-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba6439si772211166b.589.2024.05.15.05.16.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7685-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=D7k2cVhb; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-7685-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7685-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 03ECD1F20614 for ; Wed, 15 May 2024 12:16:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8E5B7441E; Wed, 15 May 2024 12:16:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="D7k2cVhb" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99A6C74416 for ; Wed, 15 May 2024 12:16:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715775367; cv=none; b=grGQRnYh/Vx+vAdYEfx5mn515RM7x/vlvnQzP2EdSdwdFzTKazPqIYEIhr/hCOxgN1PV8YrMvoyzGHKUvhvoedb+t9gGGphEXcyWYsRjV0/28up8vTM7S09WcJ47iOCaQiRLmDZ37LG1Nu4a1LpliEBKRA49ZkNPvUHbomDXrLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715775367; c=relaxed/simple; bh=diKJUdrqltDDq72ItvhagNv5YQOX4bos/g65U+9+Bek=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sEWmv3sWB1bOmNCUVXbAqzqMWDD8RQ5ds1D2C4Iv7tqfH4dZZtngsm9YJyx1CGE9wWKKMLW3wqlpb6tIWAC/2XLLHLLaHCx3vHpO9nnUIHMJB7sPp/QZA7qi3cZEtk/YY1Uvlwcu/BwmIcoSnlCF211sKlTQKX2LEOfYUT7gj5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=D7k2cVhb; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=fkuhbwjfpmhiKKeaZ7lZ91SaVCGdFoO3hkLfDGnNvfE=; t=1715775365; x=1716984965; b=D7k2cVhb8bbQO3k4qlyZKJrVQbo5ov8q5YiHOGH4anKd7w57RROwfhWAhe7PBBGYefyMJYgAWJn SSLub3EnVN0EbhiKwm1Ym3ruj7IYa2NX1M1BCfhcSI+rCs62rBCC3flOhCbWmQmBeTTWqgvQ9y2oe 1yfs+GoGygW1Dt6Pbmoogj2DlvX2FHHJk2UdDXnYIytwJ4W8CGlDfopydpbDj+G+tAHMQqzN0ICZy ozIlxPwhMUbJRD+6ECCcBE1c2XdsGuTCsxpj+yYRGHQc+yn4n31Kxu8/uIdK4znL6fxqb0/9z0UUE CA7Exf4MzM3UQcbVrxo1wUGjDNJIjT+PLE+A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s7DYA-00000006PX1-2UwG; Wed, 15 May 2024 14:16:02 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , syzbot+bc0f5b92cc7091f45fb6@syzkaller.appspotmail.com Subject: [PATCH] wifi: nl80211: disallow setting special AP channel widths Date: Wed, 15 May 2024 14:16:00 +0200 Message-ID: <20240515141600.d4a9590bfe32.I19a32d60097e81b527eafe6b0924f6c5fbb2dc45@changeid> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg Setting the AP channel width is meant for use with the normal 20/40/... MHz channel width progression, and switching around in S1G or narrow channels isn't supported. Disallow that. Reported-by: syzbot+bc0f5b92cc7091f45fb6@syzkaller.appspotmail.com Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3c0bca4238d3..93c313149f57 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3415,6 +3415,33 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, if (chandef.chan != cur_chan) return -EBUSY; + /* only allow this for regular channel widths */ + switch (wdev->links[link_id].ap.chandef.width) { + case NL80211_CHAN_WIDTH_20_NOHT: + case NL80211_CHAN_WIDTH_20: + case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + case NL80211_CHAN_WIDTH_320: + break; + default: + return -EINVAL; + } + + switch (chandef.width) { + case NL80211_CHAN_WIDTH_20_NOHT: + case NL80211_CHAN_WIDTH_20: + case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + case NL80211_CHAN_WIDTH_320: + break; + default: + return -EINVAL; + } + result = rdev_set_ap_chanwidth(rdev, dev, link_id, &chandef); if (result) -- 2.45.0