From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6B1E563B8 for ; Mon, 20 Feb 2023 13:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E488CC433D2; Mon, 20 Feb 2023 13:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676901239; bh=aML26oZ34ikXf0VDcOrKjwMUxcqeUXxSKuWmja9cbEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6daRmY3F6BZmXqdms/hUK3LRvhNbIUfGcv9oXf62L+yDDB5Y3IONKWukb2IYgwDZ p9yOt5w5LMuPKFFZH/YaV7KAGh0htj5LrZKo0H/kV7IDkH7oySPtWQbSwZ630vU7qA ua5q4KIrOES62sPRfeCA2BJv5ROill6fX8omxGVU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Simon Horman , Kees Cook , Jakub Kicinski Subject: [PATCH 5.15 82/83] net: sched: sch: Fix off by one in htb_activate_prios() Date: Mon, 20 Feb 2023 14:36:55 +0100 Message-Id: <20230220133556.604507547@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133553.669025851@linuxfoundation.org> References: <20230220133553.669025851@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Dan Carpenter commit 9cec2aaffe969f2a3e18b5ec105fc20bb908e475 upstream. The > needs be >= to prevent an out of bounds access. Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority") Signed-off-by: Dan Carpenter Reviewed-by: Simon Horman Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/Y+D+KN18FQI2DKLq@kili Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_htb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -429,7 +429,7 @@ static void htb_activate_prios(struct ht while (m) { unsigned int prio = ffz(~m); - if (WARN_ON_ONCE(prio > ARRAY_SIZE(p->inner.clprio))) + if (WARN_ON_ONCE(prio >= ARRAY_SIZE(p->inner.clprio))) break; m &= ~(1 << prio);