Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp886602lqp; Thu, 23 May 2024 03:05:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWy5pdPUTYcmbOhTFOyGZYNMjCLzUm89fjX++mAtu749tnaQeX12Xy7KATiptcqj3vKMV3FRAra9E28Xd3hTXMizF9hP8pyKol3IO2KwQ== X-Google-Smtp-Source: AGHT+IEqZ/fJbBwzDDgdxZldKysGs+OYQQEC5Taq1aMzDDWmTRSrdOfEV0o59Yis/FO76wT3a0PC X-Received: by 2002:a05:6214:5690:b0:6aa:dd7e:ddbd with SMTP id 6a1803df08f44-6ab7f358314mr47409316d6.15.1716458748645; Thu, 23 May 2024 03:05:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716458748; cv=pass; d=google.com; s=arc-20160816; b=GwDS9XE+tDKuKE5n4tf0HFFlvtFxOCBXhjgzOitqqYSplIwYkrLe7XJdCGgHLnuJpR ieo8XsCik8bfHAypWI9pCzmopZZyxlDEit7gbi24PQ0BTuVvlOgujMn548ZfMxwiZcKj zMPKy8QXsEFJ0z/YUdyEQKIkRcdmvmDEOtdxeTyxCtrE7FnkYUyTxQ9iwYWXHZ93mJFR sw1V8M00m/yRJi9Vk8lQiwvp42Llgw4i1cNITiO71fliTFH0rg1li/S6myrXWy3a6m4a POm8TChhhh09MVcqzgX1pS6Y6bE9fPWOWUZtF14C7eAEQTxsWK04YvIkWkClhIHK4Fya +kLQ== 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=+P/eQDosxBeUaoWDIKIA4+eNBAo+H3Pt2ohS5winJn8=; fh=6tAb0kCEXvaHOeehd7it0IoDhBnNzxkwobGCklv/6JY=; b=Oc++WLAMQ6L0cUso52551Wj7kqsIzM4TF2sP5Y8LR63DS93u812VIG6D/H4GH77Url tt2nIBc1N5RDT/qHBN2OYIkKWTUcllpnaWazD3NnnU0TxdjdyGlZOroYa3ephhMOMD2y gg4nAJp7Fo1bt3q1Ib64+ud+Zed02pnY/z/3xOlF/BY4pjQnHLDX2cvb39Sskb6acZLD 2ShKVe2AqwVqIBTuPJscKTviKeb7Zp1528OzRjSlR9TaYc5z1+WMGiYSqPYs07dbJvuY FRooC0522g1cNi9y5v4jnmnIjPtxQ205igHT5iks3mDRuJXbX34XEFToWTD3JYW95wt7 TTig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=n4kX0asJ; 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-7995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ab7094bb5fsi27248616d6.177.2024.05.23.03.05.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 03:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=n4kX0asJ; 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-7995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7995-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0669B1C226B3 for ; Thu, 23 May 2024 10:05:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F49613CF96; Thu, 23 May 2024 10:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="n4kX0asJ" 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 C202054FA9; Thu, 23 May 2024 10:05:38 +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=1716458740; cv=none; b=rE47nz78UqhS8wNX1mzIKOpj93UldfPZHUHNBiB90xBhWRpthBGPwVShH5RVa3Cx54AO3X3SwRZtMgNW9JFO9hAJW8GCKZmGttIIBAc/jFu2kgzDBSt2IR0k1pHzTQu7fqhkgcRoDXjZMCbfWRzUysWj8h2VCI/dE0DqJrrzwFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716458740; c=relaxed/simple; bh=p93URBzyg0Jvf6+HXExvml57wxsAqkDZrQy+YNck1Ng=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JHkgHx97x998Mq09B3BI3vboO3ELgsSxFl7zxLI4HQc3UFvVC1c7fitDAjHDR0ZJegwANRe3z5roYcJC+LyFhyWdhtq19CbrIQl7LpLnXvPtgQoc6WK3AgJv39XPFl4xC7yA0ZLMP2okL82LgRwJId+8Lvbevhjz+PXOoeOeRTk= 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=n4kX0asJ; 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=+P/eQDosxBeUaoWDIKIA4+eNBAo+H3Pt2ohS5winJn8=; t=1716458738; x=1717668338; b=n4kX0asJ5VHK/o8xyt0yA1fzqiM6IAnp7el2LsnMgqGEBIKf1vXGvd9FytHMoavJurUX/RP8hjD AAZHQsLISk7ZWObjysxw3wl1P+guQrvAi4WlwaHCjDLLFCCdvv7Df/+olxHAJLtd9agwfj03It5GT wpQfW1uDyQpEk44lTNC0LMWRTuS0NbwfmqnHRXCmFT/x0TPEVqcu5FFortgMgubn96F6g+qzYZmDO wd9WHBR2eulKz0lLVVGwbPGpXsjH70W07NCUDge5v86w/muTF1Et6iRuGs0ddu5x51RfGl3bNM6Rk PHN42XIbAaMhnoPJA2D36iQbFoqJFpkuLTYg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sA5KJ-00000005wQq-1GL5; Thu, 23 May 2024 12:05:35 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , stable@vger.kernel.org, Miriam Rachel Korenblit Subject: [PATCH] wifi: cfg80211: validate HE operation element parsing Date: Thu, 23 May 2024 12:05:33 +0200 Message-ID: <20240523120533.677025eb4a92.I44c091029ef113c294e8fe8b9bf871bf5dbeeb27@changeid> X-Mailer: git-send-email 2.45.1 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 Validate that the HE operation element has the correct length before parsing it. Cc: stable@vger.kernel.org Fixes: 645f3d85129d ("wifi: cfg80211: handle UHB AP and STA power type") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/wireless/scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 127853877a0a..8daed8232b05 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -2128,7 +2128,8 @@ static bool cfg80211_6ghz_power_type_valid(const u8 *ie, size_t ielen, struct ieee80211_he_operation *he_oper; tmp = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ie, ielen); - if (tmp && tmp->datalen >= sizeof(*he_oper) + 1) { + if (tmp && tmp->datalen >= sizeof(*he_oper) + 1 && + tmp->datalen >= ieee80211_he_oper_size(tmp->data + 1)) { const struct ieee80211_he_6ghz_oper *he_6ghz_oper; he_oper = (void *)&tmp->data[1]; -- 2.45.1