Message ID | 20221013175148.401850770@linuxfoundation.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp406602wrs; Thu, 13 Oct 2022 11:00:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zu+ysAFpzLUNzWW3YKUXLVwiSXykzETkFSdIN43+2XMELNPsDA6Co7kGObEgeHHxc+uYm X-Received: by 2002:aa7:dc10:0:b0:440:b446:c0cc with SMTP id b16-20020aa7dc10000000b00440b446c0ccmr876173edu.34.1665684045788; Thu, 13 Oct 2022 11:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665684045; cv=none; d=google.com; s=arc-20160816; b=YGXZpR7CqYufhei6BoYuXf/wrgQMLxtFdCXaRBKz3rf/QAdHQnPKY/xKwK5tf6mKI8 uxXtAhsw2tlUJM1ndfK/xHKOjBtk56Scrp3kOPpXzHcW7GeKVoYTcLjVaqGfEKNFxh7p Zsmv5f1Au8mOW4vsgvM1rw+28MrZX7FZf4svuDSHdXKJEJGfiaEFs4pH62Ex9j206pL6 pgCdP6luSleK+9IM6F4jUd7Xdy4/DO8E9ugsSD9QV6/XIuYf6ZFDDHWt3TYmQqKy0d5L 3/r+2Ur1iEG1BuX+QjIA4WMR+Aogyppu2/xvKgy9ziFjNXwvcwyzwP3/HKoq/CmR7yPE LVuA== 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=2mRWGbVjI4W7f+DSrDBhfn2nETn1W51boj059dU66Ro=; b=q/idbMVSWgg/WjkEAs+hdlik9JjqEeJgJ8+hh/bNQdNYws1DC0K8Fz50se7Xc+qA90 PO9qNw5eO/otE+W92H3Mb0FtqhoTrOktT4fd+nxScfVCc5zpYgJAEV0Cr1f2hcWKQmNY 3qGRIF6bfOIMfyo/UZJ4WqVzx8EniGIybLG+fRKqIeFFOif9U3ofbArD0njM96OKnPUm 8HP/NysZIxdHhp4b57uz5VdkxyAaj1DdwI0CRZqTpSa1lUkHdxFLm/xTlrFDoF3qlenH atpvOqOT1J1s1Qhq6rqs8IA6euLhK2edVvNM1yYolWCaEVfIfI6eiI7ypmhcVWBRCjif tSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2lN+c9K0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s24-20020a056402015800b004520e27e5b9si235426edu.626.2022.10.13.11.00.20; Thu, 13 Oct 2022 11:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2lN+c9K0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbiJMR6l (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 13 Oct 2022 13:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbiJMR5n (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Oct 2022 13:57:43 -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 603AC42E6A; Thu, 13 Oct 2022 10:56:55 -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 4CC97B82035; Thu, 13 Oct 2022 17:56:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 956A6C433D6; Thu, 13 Oct 2022 17:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683809; bh=BQg7TdDlUGVhcho5kWg/b23l3aF2B/eDKAnzaIJ0uVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2lN+c9K0XxG5zlHnJMq5mLrBAajn+1DUXDXR82U0Rn/mED43wQhinVtICcG54Q9co ckKHbjj2Ni1nMaAUnuEY6YF2wCC12/Om2Xdao7RUTU9JvowhP4XQ7OrjoGrwzwlRes l8jKGB91iTnbRNN2XrQAsbncY7ty9r5OrmjybfBo= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Kees Cook <keescook@chromium.org>, Johannes Berg <johannes.berg@intel.com> Subject: [PATCH 5.10 44/54] wifi: cfg80211/mac80211: reject bad MBSSID elements Date: Thu, 13 Oct 2022 19:52:38 +0200 Message-Id: <20221013175148.401850770@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175147.337501757@linuxfoundation.org> References: <20221013175147.337501757@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746596313923310285?= X-GMAIL-MSGID: =?utf-8?q?1746596313923310285?= |
Series |
None
|
|
Commit Message
Greg KH
Oct. 13, 2022, 5:52 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com> commit 8f033d2becc24aa6bfd2a5c104407963560caabc upstream. Per spec, the maximum value for the MaxBSSID ('n') indicator is 8, and the minimum is 1 since a multiple BSSID set with just one BSSID doesn't make sense (the # of BSSIDs is limited by 2^n). Limit this in the parsing in both cfg80211 and mac80211, rejecting any elements with an invalid value. This fixes potentially bad shifts in the processing of these inside the cfg80211_gen_new_bssid() function later. I found this during the investigation of CVE-2022-41674 fixed by the previous patch. Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning") Fixes: 78ac51f81532 ("mac80211: support multi-bssid") Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- net/mac80211/util.c | 2 ++ net/wireless/scan.c | 2 ++ 2 files changed, 4 insertions(+)
--- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1409,6 +1409,8 @@ static size_t ieee802_11_find_bssid_prof for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, start, len) { if (elem->datalen < 2) continue; + if (elem->data[0] < 1 || elem->data[0] > 8) + continue; for_each_element(sub, elem->data + 1, elem->datalen - 1) { u8 new_bssid[ETH_ALEN]; --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -2093,6 +2093,8 @@ static void cfg80211_parse_mbssid_data(s for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, ie, ielen) { if (elem->datalen < 4) continue; + if (elem->data[0] < 1 || (int)elem->data[0] > 8) + continue; for_each_element(sub, elem->data + 1, elem->datalen - 1) { u8 profile_len;