]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: qca: fix info leak when fetching board id
authorJohan Hovold <johan+linaro@kernel.org>
Wed, 1 May 2024 12:34:53 +0000 (14:34 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 3 May 2024 17:05:33 +0000 (13:05 -0400)
Add the missing sanity check when fetching the board id to avoid leaking
slab data when later requesting the firmware.

Fixes: a7f8dedb4be2 ("Bluetooth: qca: add support for QCA2066")
Cc: stable@vger.kernel.org # 6.7
Cc: Tim Jiang <quic_tjiang@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btqca.c

index 664db524b1dd496fa0ba27f65f912dcb837d183b..8d8a664620a360c1a07b9329e69d0c3d529a9d32 100644 (file)
@@ -252,6 +252,11 @@ static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid)
                goto out;
        }
 
+       if (skb->len < 3) {
+               err = -EILSEQ;
+               goto out;
+       }
+
        *bid = (edl->data[1] << 8) + edl->data[2];
        bt_dev_dbg(hdev, "%s: bid = %x", __func__, *bid);