Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9077167pxu; Mon, 28 Dec 2020 06:06:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAlMkW45uQgLUMTzngk8S1oDZu9rSbQlcnSwva4dzAGxHnU6i5hsnBdD1xiexF2oHscKvB X-Received: by 2002:a17:906:6c8b:: with SMTP id s11mr41381425ejr.187.1609164393937; Mon, 28 Dec 2020 06:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164393; cv=none; d=google.com; s=arc-20160816; b=DSWtuDk6T5Z1ddu61kFzmVnW/wRdHGhn1pw3/A27XnBjxxPrbUfJYPAser3sowy2q3 3f4ppq9RqWYcerQCjzLKCEQlqlqOp6Wg7SeRw8c7tD8cyFOOoQ4C7ZU3JNWcaf8KWtHE TPRGCyt4dV+2EwYJPFCApG56/bl57u3zJh0z1NB+z7JgFrCa7voBS/O6lPzCJciNZjtd Ld8Z0Qj3GHm8xhiTQRVaWNLTERBD/2vYfnxy6reIuRNKaHLZqmr6ypYHyoM+KEULhYEB fxLFuRZddqc+gKjDUjNbVtfpRBYIlZJi9qlrXZSTEybc/IW9SkbnFF/1v5UiDf6ZyNvm LZ4Q== 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=9PcP2QsaUBAjcd7nbBbeXn1BsrnWBB7j/mV53c5HUcc=; b=v9S7RVquoXD+c7p83JAosHARB5F0XrJml71tjHHwQMQSldLeAxbG2ErEizsVWjNon/ ZeK9UUOXtz/fU7qWzMLOXCdC2nVC96Yelxdc0H465MyPe8xiNBQ4Z2omwDr2dhMXUoZL qCaAaXtx+jy5gqm8NO/nMrKFl7p94Tv2Apwe7GL+qyb4VWep9uXqch0sWWz9YbUuuFVx XZ/fm7eZ0PzYFkN6iFa3wQPpYMD9lK35UA0+cjACCagCcVpbEBGiHFKJ57Gqn6ymMTI6 2WsHbeqtMy69APBdi0g9ueUtMYRtA+4RrZO9+D9fBprFefwBLMBRR70w8clUgaEKEt2l g6Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E8LJ94vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay21si20353938edb.575.2020.12.28.06.06.11; Mon, 28 Dec 2020 06:06:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E8LJ94vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407581AbgL1OCZ (ORCPT + 99 others); Mon, 28 Dec 2020 09:02:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:36052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391593AbgL1OCU (ORCPT ); Mon, 28 Dec 2020 09:02:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EB81020799; Mon, 28 Dec 2020 14:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164099; bh=Jgkb4yCMuMlCUzTk9lCQrpRyEkQGvnjCghzrRVr3QlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E8LJ94vo0u3XBgk3k6QJeyJeeaRmZrMdNN28JdeZtFYQvpjkEJtgA+YHapGJkUP7O eIi6AAvKk2E0l5h2vwMenOQktximIOhMBRe0N4OgIUMflSq1LJRmFIjO6+BGa/YTwN TKj6T3CyZPiijtgIFELNBoqo/8zsgyGUNmI6EO8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Johannes Berg , Sasha Levin Subject: [PATCH 5.10 060/717] nl80211/cfg80211: fix potential infinite loop Date: Mon, 28 Dec 2020 13:40:58 +0100 Message-Id: <20201228125023.872264837@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit ba5c25236bc3d399df82ebe923490ea8d2d35cf2 ] The for-loop iterates with a u8 loop counter and compares this with the loop upper limit of request->n_ssids which is an int type. There is a potential infinite loop if n_ssids is larger than the u8 loop counter, so fix this by making the loop counter an int. Addresses-Coverity: ("Infinite loop") Fixes: c8cb5b854b40 ("nl80211/cfg80211: support 6 GHz scanning") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20201029222407.390218-1-colin.king@canonical.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 8d0e49c46db37..3409f37d838b3 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -694,7 +694,7 @@ static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request, static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap, struct cfg80211_scan_request *request) { - u8 i; + int i; u32 s_ssid; for (i = 0; i < request->n_ssids; i++) { -- 2.27.0