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=1796380030; b=RcTd6LTmkBWRkc34fEBiz97sTHrYCO5YIcHUszC87KVMdW1paL/YNGrDx9FfX3iYy0CB EnaM1vACA565k2Hvtxouxst8Oa+7oXqpDXul+uqvSBXTOj7/sw/4h6u+oRuCcLaf+KQwr azXrVv+qD/I0bSnidB4zG/YYARln9A4/eKW5cAhmASKBX/0Q2iWQRrJyu6MN/htFisrDN Kv+G4WMCiz5YYYfFOnjX2ExcLd7YZPd8pdjJt7tTGKO/iXmc7hFoSVC4K20qRcq2dipdv WlCC47nrMm5PiVyqfLXEbWgJuBq1XTMxhsUFoHZu/ZurL4pZXIuXzhgaXAqLTrT8tIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380030; 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=7OGT6RMbCGmjgsCIVim6p4nECZI+e9WY2UTcgxpUiFI=; b=IMbcgwO8gaelhTfrariTbF4CVDrEbvCKAKGBcynCuREwq8GJ+mjbiNjUkK5uDYgFbXGv Dp7SvvRGEJltVg8ABqUtvbq+8KahtkriLi53szXQ96cbO+vYVvkRxKEM78vAvXJlcaNIA HwsqoonGg5GIg3z5YPyO078iZCqVYDCxQ6HCu9DsYYAH5MQZe2lycEIJcTeIYUubgeuy5 P5CuMyBqlZaqHzA+MWpdCc6grR1FemZTF26Ba1SFBJQW3D7GkbP+WbfNr3cUXmEzld4mS OTOith4sdsR+G79nVBeR2PqF7iCU8dRKSwR8WpA7N01KGNy5+wSRwQ/hRni2VJJvIkg== 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=z93zb7Vk; 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 52734606A322; Fri, 4 Dec 2026 10:27:10 +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=z93zb7Vk Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC0961F000C2; Fri, 4 Dec 2026 10:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380030; bh=7OGT6RMbCGmjgsCIVim6p4nECZI+e9WY2UTcgxpUiFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=z93zb7Vk9xkC5fVWVqL7El/VHCjoJDlT8S+/tyc08PcHVnvxOATv5ytjERCdQ+dP+ PoVTo1FS6xaVdLsXUaRqtAhzYtSUNWJtI+ddWRyRAA4VqVOnC4fTNVXgP2g6CJeese Zguuk3KCLSqSdHbtNPTnklfbSardaHCoR9y9Q0SY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 7.3 098/742] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Date: Fri, 4 Dec 2026 18:59:22 +0900 Message-ID: <20261204100637.708168243@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz [ Upstream commit c592dfe9637c65eeaff4c9f6fd869f39ad7ae472 ] The advertising instance returned by hci_find_adv_instance() was dereferenced without hdev->lock and could be freed concurrently. Reported-by: Sashiko Link: https://sashiko.dev/#/bug/linux-616b1f8e-06ec-4634-a907-5eb4e82f66df Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2") Assisted-by: OpenCode:claude-fable-5.2 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_sync.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 6227a07fc9566..adae6e2fee1e1 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -2129,9 +2129,13 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance, if (hdev->adv_instance_timeout) return -EBUSY; + hci_dev_lock(hdev); + adv = hci_find_adv_instance(hdev, instance); - if (!adv) + if (!adv) { + hci_dev_unlock(hdev); return -ENOENT; + } /* A zero timeout means unlimited advertising. As long as there is * only one instance, duration should be ignored. We still set a timeout @@ -2161,6 +2165,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance, secs_to_jiffies(timeout)); } + hci_dev_unlock(hdev); + /* If we're just re-scheduling the same instance again then do not * execute any HCI commands. This happens when a single instance is * being advertised. -- 2.53.0