Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3463870pxk; Mon, 5 Oct 2020 10:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeYL2ptaLF9buRP3o/wcmBlIjVxha+njV/E6/UYeAg+GH9UUh9kJpYiQo9X23JhuTV43YC X-Received: by 2002:a17:907:94d0:: with SMTP id dn16mr744365ejc.356.1601918159456; Mon, 05 Oct 2020 10:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601918159; cv=none; d=google.com; s=arc-20160816; b=tyxSr4oydY+B6L1qvhsH92dF5hF/tnTKRZZuCEkmNDQ6hCSjrUryxpzDtHbS4fnTth 95hLd4VtkPsCvcAVMJikwVRw11LdAc0xxSCsofQlj2ILlLau5rEoUPsne3QyL284T8j2 wgYYdbgl6b1jYwNEOqNVww/p4xY0mZwJQ3X+uLL8AZRtjRtBNk8gt3kaMbtWe45jvkRb g2TGK8glEa6AzIaZQf45m2/relcKxXHVQSSU2NmrOuSz3IKLQgpbJdQb4ivCgpd7EwIY 0RCUPy0JFBuDpH4nDJp7CFyq7YKYYFEX1SkyONxZF35p7ny42xlJ74gekSH8XErVt2b+ IxJQ== 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 :message-id:date:subject:cc:to:from; bh=GcbZebmKd1dCNa8jQMeSzYHWWl47Bcpl9R6H+DlvE5w=; b=mGMA9/d6/dGrDSybN35vA2qEi677NwKsvtGxVPueiT2B9h/cli+ncrUKPmtmDjZNag d8MBfEVjcvESjiA7XsO87Dq4D1qh0eWe7LlF0ERaK9W0kwfVNJqH5PbYpsXI5Wi57CVv kY9rKbQf9dnY8S5so6M8fTAolTls5qFWw2z4kLq5qTLJyq1ZHzgi6eZKx7nX3b4s1vxe rNltm8mXUQ0SPJ6NzQCAhB8/edOExr+76tJ+RzHtXwz9pn7wN+vJ5vS1NBthqwRdi/H6 Se8oH8K4c9WpE0YhCeuXRvMGEsuRij3HOZFrPO8Y1TbvI/Yc02QIwgMsDlrCIWass1yi lEIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si411716edr.166.2020.10.05.10.13.58; Mon, 05 Oct 2020 10:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbgJERC6 (ORCPT + 99 others); Mon, 5 Oct 2020 13:02:58 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:37164 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726320AbgJERC6 (ORCPT ); Mon, 5 Oct 2020 13:02:58 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id C0EBC4FA159; Mon, 5 Oct 2020 16:51:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at web.adapt-ip.com Received: from web.adapt-ip.com ([127.0.0.1]) by localhost (web.adapt-ip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id u1y-kOCBxBGU; Mon, 5 Oct 2020 16:51:21 +0000 (UTC) Received: from atlas.ibsgaard.io (c-73-223-60-234.hsd1.ca.comcast.net [73.223.60.234]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id BD4DF4FA158; Mon, 5 Oct 2020 16:51:20 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen , syzbot+92715a0eccd6c881bc32@syzkaller.appspotmail.com Subject: [PATCH] cfg80211: only allow S1G channels on S1G band Date: Mon, 5 Oct 2020 09:51:22 -0700 Message-Id: <20201005165122.17583-1-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As discovered by syzbot, cfg80211 was accepting S1G channel widths on non-S1G bands. Add a check for this, and consolidate the 1MHz frequency check as it ends up being a subset of the others. Reported-by: syzbot+92715a0eccd6c881bc32@syzkaller.appspotmail.com Fixes: 11b34737b18a ("nl80211: support setting S1G channels") Signed-off-by: Thomas Pedersen --- net/wireless/chan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 96e24ee4c7e8..22d1779ab2b1 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -207,7 +207,6 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) control_freq = chandef->chan->center_freq; switch (chandef->width) { - case NL80211_CHAN_WIDTH_1: case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_20: @@ -218,10 +217,14 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) if (chandef->center_freq2) return false; break; + case NL80211_CHAN_WIDTH_1: case NL80211_CHAN_WIDTH_2: case NL80211_CHAN_WIDTH_4: case NL80211_CHAN_WIDTH_8: case NL80211_CHAN_WIDTH_16: + if (chandef->chan->band != NL80211_BAND_S1GHZ) + return false; + control_freq = ieee80211_channel_to_khz(chandef->chan); oper_freq = ieee80211_chandef_to_khz(chandef); control_width = nl80211_chan_width_to_mhz( -- 2.20.1