From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0D5E3383C88; Sat, 12 Sep 2026 19:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789239874; cv=none; b=Qb3CIGuzFRcXmky5Jl/VB8cismgwy7LZHbPeeqpXXB7yrPGKNGtj03AcQ1ZMBE8nSgSOXtJwuu3BjVQxmBc3MPItzH75NeWfBGDo0MWxfjnq28jTShvT51jWjtCFgxlXHYgH7NiQRGipefhDLoU6+9KpkU71+eRfr7WxA2P0ZsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789239874; c=relaxed/simple; bh=c6HjLo+ESgClYyY2AN079DZqwYhx6JJLjl7ish13ERQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q+goJ9IWfa/4Fe0GiEitv6+CY493Ca61FyIlvhxiCUYrtEAmaLXK5qid6srXnl7k6uUA8KUV6GyByDs1rwb2RfZQjHT2aGiUBG+9XdH2kepGq0/k1T6DxzLtW1oum+sLP8ws+UZ5U5ll5MaNoYU22sf4t+qu26pbSCgsriouU/I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dxvYDW/Y; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dxvYDW/Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCEE81F000FF; Sat, 12 Sep 2026 19:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789239872; bh=1BoTOVXxyMq7C7GvOhbovIcRIAQHvCeXXbmN/R7gGcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dxvYDW/Y43Pbo2cOjXey8gDMMU0csKNvT6JfD3R5cYEsRPLqTb13SgZ9ao32s68Mv 9rKLl9trKbrhA1r2CO1Co1n4+wo8ihBtROXmW0Bdt6X7l3WuohQKHjwOBOE5NoA+hQ +9488T9ARbk106xxjDev7Vby7vamTQvUlwaltHSo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, HyeongJun An , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.15 752/935] Bluetooth: virtio_bt: avoid OOB read of build info string Date: Sat, 12 Sep 2026 09:03:02 +0200 Message-ID: <20260912065544.079766001@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An [ Upstream commit 502adc06ba76dee19c292ae4a07d74d202fe734d ] The virtbt_setup_zephyr() sends the Zephyr vendor command 0xfc08 (Read Build Information) and hands the response to bt_dev_info() and hci_set_fw_info() as a "%s" string starting at skb->data + 1, without checking the length. A backend that answers with status only leaves that pointer past the end of the received data, so the walk reads adjacent slab memory until it meets a NUL. Those bytes reach the kernel log and the firmware-info debugfs file. To fix this, print the string with a bounded "%.*s" limited to skb->len - 1. A short or unterminated response then prints as much as arrived instead of failing setup. This mirrors commit dd068ef04412 ("Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()"), which fixed the identical pattern. Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver") Signed-off-by: HyeongJun An Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/virtio_bt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c index 2d060ea6da847..ed7d4ed4b575e 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -112,9 +112,13 @@ static int virtbt_setup_zephyr(struct hci_dev *hdev) if (IS_ERR(skb)) return PTR_ERR(skb); - bt_dev_info(hdev, "%s", (char *)(skb->data + 1)); + /* Bounded print: the backend controls skb->len. */ + if (skb->len > 1) { + int len = skb->len - 1; - hci_set_fw_info(hdev, "%s", skb->data + 1); + bt_dev_info(hdev, "%.*s", len, (char *)(skb->data + 1)); + hci_set_fw_info(hdev, "%.*s", len, skb->data + 1); + } kfree_skb(skb); return 0; -- 2.53.0