From: Johan Hovold <johan@kernel.org>
To: Johan Hovold <johan+linaro@kernel.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Doug Anderson <dianders@chromium.org>,
Janaki Ramaiah Thota <quic_janathot@quicinc.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/3] Bluetooth: qca: add missing firmware sanity checks
Date: Wed, 1 May 2024 08:27:23 +0200 [thread overview]
Message-ID: <ZjHgy9m8Sh0t9S4y@hovoldconsulting.com> (raw)
In-Reply-To: <20240430170741.15742-2-johan+linaro@kernel.org>
On Tue, Apr 30, 2024 at 07:07:39PM +0200, Johan Hovold wrote:
> Add the missing sanity checks when parsing the firmware files before
> downloading them to avoid accessing and corrupting memory beyond the
> vmalloced buffer.
>
> Fixes: 83e81961ff7e ("Bluetooth: btqca: Introduce generic QCA ROME support")
> Cc: stable@vger.kernel.org # 4.10
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/bluetooth/btqca.c | 38 ++++++++++++++++++++++++++++++++------
> 1 file changed, 32 insertions(+), 6 deletions(-)
> static int qca_tlv_send_segment(struct hci_dev *hdev, int seg_size,
> @@ -532,7 +556,9 @@ static int qca_download_firmware(struct hci_dev *hdev,
> memcpy(data, fw->data, size);
> release_firmware(fw);
>
> - qca_tlv_check_data(hdev, config, data, soc_type);
> + ret = qca_tlv_check_data(hdev, config, data, size, soc_type);
> + if (ret)
> + return ret;
Bah, I realised late last night that I had forgotten to fix this error
path before posting v2. This was supposed to say
goto out;
to make sure the firmware buffer is released in case we ever encounter
malformed firmware.
I'll send a follow-up patch.
Johan
next prev parent reply other threads:[~2024-05-01 6:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 17:07 [PATCH v2 0/3] Bluetooth: qca: generalise device address check Johan Hovold
2024-04-30 17:07 ` [PATCH v2 1/3] Bluetooth: qca: add missing firmware sanity checks Johan Hovold
2024-04-30 17:43 ` Bluetooth: qca: generalise device address check bluez.test.bot
2024-05-01 6:27 ` Johan Hovold [this message]
2024-04-30 17:07 ` [PATCH v2 2/3] Bluetooth: qca: fix NVM configuration parsing Johan Hovold
2024-04-30 17:07 ` [PATCH v2 3/3] Bluetooth: qca: generalise device address check Johan Hovold
2024-04-30 21:21 ` Doug Anderson
2024-05-01 6:31 ` Johan Hovold
2024-04-30 21:51 ` [PATCH v2 0/3] " 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=ZjHgy9m8Sh0t9S4y@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=dianders@chromium.org \
--cc=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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox