All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan+linaro@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Janaki Ramaiah Thota <quic_janathot@quicinc.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>,
	stable@vger.kernel.org, Tim Jiang <quic_tjiang@quicinc.com>
Subject: [PATCH 2/5] Bluetooth: qca: fix info leak when fetching board id
Date: Wed,  1 May 2024 14:34:53 +0200	[thread overview]
Message-ID: <20240501123456.6712-3-johan+linaro@kernel.org> (raw)
In-Reply-To: <20240501123456.6712-1-johan+linaro@kernel.org>

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>
---
 drivers/bluetooth/btqca.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index a508d79d9aaa..638074992c82 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -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);
 
-- 
2.43.2


  parent reply	other threads:[~2024-05-01 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01 12:34 [PATCH 0/5] Bluetooth: qca: info leak fixes and cleanups Johan Hovold
2024-05-01 12:34 ` [PATCH 1/5] Bluetooth: qca: fix info leak when fetching fw build id Johan Hovold
2024-05-01 13:10   ` Bluetooth: qca: info leak fixes and cleanups bluez.test.bot
2024-05-01 12:34 ` Johan Hovold [this message]
2024-05-01 12:34 ` [PATCH 3/5] Bluetooth: qca: drop bogus edl header checks Johan Hovold
2024-05-01 12:34 ` [PATCH 4/5] Bluetooth: qca: drop bogus module version Johan Hovold
2024-05-01 12:34 ` [PATCH 5/5] Bluetooth: qca: clean up defines Johan Hovold
2024-05-01 20:00 ` [PATCH 0/5] Bluetooth: qca: info leak fixes and cleanups patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240501123456.6712-3-johan+linaro@kernel.org \
    --to=johan+linaro@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=quic_janathot@quicinc.com \
    --cc=quic_tjiang@quicinc.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.