From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387217; b=KLf1i7SDi0iXDOQBItmjLl8uQTqXOFtb6aUI/CqStM/yHRRLB/BE+uUiU/slbuJ107FS sGx2LooLjFnXvNwv9KJDqcWbhY4b9WnLpt7oHGh2qmiHig0ZQdKsmBhBNcUV1U7LK8uE2 0yhT1WjRVOAYWRl1iWRMjGUMLnimRhpAmUhUcXn6sSSZwgGr1hRMn9TE3jSBtwbgQ1LUq /2QUzIgB4leQX6dgwZaWe+lOYXakd+Us7oPQQvibmO18fmWJP377NuH0cb+GHGr2VW/E/ Q6Bw7wnu7q8acoIKUEjYszQnmcC8SOqqDMuOwzhIxiueRZLoVtMhR8RsI/P85QvDMmg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387217; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=dv5bvpLFKej60txiVLGabn0BUeqhTvqWa+ZNvtM18DI=; b=2/EKDviu0oM168+/zllyeEB5Xb3EZiqJpTmQHYhYJaCwlBq/0BOQEEnYaR8BNcwezSaz uh1g+NUQkdoddxIKJC2tWjCp84cpl+KzsovolssCOBkmt52cOjzzRHbHO2IDQwPnQV4b0 cvFpGCnYr1DSserK4vxUQP6LO4kn4Jpi/nIeVhA5SGAiJpw60YNi1IdMZDczi0W1clLfv uBaJ2qw2OIumIMYclhJEE4616P+3+0dwIX2V9OtBAqDEmsQ27jV7sBNHLpXFyN+jDOfXQ saqd6h3BYSve0b3RWX9vaKJlPj6TEErnSefCqYUuWEXvVGiku2177QIPMtx42B7dC3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="o/UbK8XK"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6299606A322; Fri, 4 Dec 2026 12:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=o/UbK8XK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D7771F0092C; Fri, 4 Dec 2026 12:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387217; bh=dv5bvpLFKej60txiVLGabn0BUeqhTvqWa+ZNvtM18DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o/UbK8XKKj+KHA9aoIgNkGRJnucNBGXsNO6m62K3Pm5dIFJ/IDbgBCLVy1SITwg/J oGbV8DIjGgwSZmWATXqvEzAZksNfs3tcyqt0qLua+VgP5DRcZTOLrorevUVdhNaT77 60FdmpuMVs/THkEiPEisuy6k8nr5Yx/cfslV6pMU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Pepper , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.1 0153/1059] Bluetooth: reject invalid LE supervision timeout relationships Date: Fri, 4 Dec 2026 18:54:44 +0900 Message-ID: <20261204100648.178451322@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Pepper [ Upstream commit c1d50a71cdee90a0c68b7a67221d8aae96d14a0c ] The LE parameter validator calculates an unsigned maximum latency by subtracting one from a truncated quotient. If the quotient is zero, this wraps and accepts invalid parameters. Exact quotient boundaries also accept equality where the supervision timeout must be greater. Compare the products directly after checking the field bounds. The validated interval and latency limits keep the products within int. This enforces the strict timeout relationship without division or unsigned subtraction. Sashiko identified the underflow while reviewing the soft interval preference RFC. The bug is already present in its unpatched base; keep this common-validator fix independent of that preference policy. Fixes: 8757825b128e ("Bluetooth: hci_check_conn_params() check proper range") Assisted-by: LLM Signed-off-by: Kyle Pepper Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- include/net/bluetooth/hci_core.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index f47a88d39c168..9e7d7ad97be9e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1964,8 +1964,6 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, static inline int hci_check_conn_params(u16 min, u16 max, u16 latency, u16 to_multiplier) { - u16 max_latency; - if (min > max) { BT_WARN("min %d > max %d", min, max); return -EINVAL; @@ -1991,19 +1989,14 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency, return -EINVAL; } - if (max >= to_multiplier * 8) { - BT_WARN("max %d >= to_multiplier %d * 8", max, to_multiplier); - return -EINVAL; - } - - max_latency = (to_multiplier * 4 / max) - 1; if (latency > 499) { BT_WARN("latency %d > 499", latency); return -EINVAL; } - if (latency > max_latency) { - BT_WARN("latency %d > max_latency %d", latency, max_latency); + if ((latency + 1) * max >= to_multiplier * 4) { + BT_WARN("latency %d, max %d and timeout %d are incompatible", + latency, max, to_multiplier); return -EINVAL; } -- 2.53.0