summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Acharya Padhya <acharyalaxman8848@gmail.com>2026-08-01 23:54:52 +0545
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-08-27 14:34:40 +0200
commitd83ecb7b96105d932dabaa56ccd7418c25fb7cbb (patch)
treea9d1590655d951aa7b3634ed625b0f0790b6e95c
parentb55e83a4ba31d40deae22d4e4dc8c84083e953c6 (diff)
downloadlinux-d83ecb7b96105d932dabaa56ccd7418c25fb7cbb.tar.gz
linux-d83ecb7b96105d932dabaa56ccd7418c25fb7cbb.zip
Bluetooth: hci_event: validate LE Set CIG Parameters response
commit 0acd4eeb4b225b9bebbf9ef96cc10cdd79b94899 upstream. The Command Complete dispatch validates only the fixed part of the LE Set CIG Parameters response. After that part is pulled from the skb, hci_cc_le_set_cig_params() trusts num_handles and reads each entry in the trailing handle array. Matching num_handles against the command's num_cis does not guarantee that the response contains the advertised handles. A truncated response from a malfunctioning controller can therefore make the handler read beyond the skb data. Validate that the remaining skb data contains all advertised handles. Include this in the existing response validation so malformed responses also follow the established CIG failure handling. Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections") Cc: stable@vger.kernel.org Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/bluetooth/hci_event.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 434b58b7cbdb..5b4c0f61b333 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3832,8 +3832,10 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data,
bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS);
- if (!rp->status && (!cp || rp->num_handles != cp->num_cis ||
- rp->cig_id != cp->cig_id)) {
+ if (!rp->status &&
+ (!cp || rp->num_handles != cp->num_cis ||
+ rp->cig_id != cp->cig_id ||
+ skb->len < array_size(rp->num_handles, sizeof(*rp->handle)))) {
bt_dev_err(hdev, "unexpected Set CIG Parameters response data");
status = HCI_ERROR_UNSPECIFIED;
}