Skip to content

Commit

Permalink
Bluetooth: qca: fix firmware check error path
Browse files Browse the repository at this point in the history
commit 40d442f upstream.

A recent commit fixed the code that parses the firmware files before
downloading them to the controller but introduced a memory leak in case
the sanity checks ever fail.

Make sure to free the firmware buffer before returning on errors.

Fixes: f905ae0be4b7 ("Bluetooth: qca: add missing firmware sanity checks")
Cc: stable@vger.kernel.org      # 4.19
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed May 17, 2024
1 parent b91390f commit 580bcd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/bluetooth/btqca.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static int qca_download_firmware(struct hci_dev *hdev,

ret = qca_tlv_check_data(hdev, config, data, size, soc_type);
if (ret)
return ret;
goto out;

segment = data;
remain = size;
Expand Down

0 comments on commit 580bcd6

Please sign in to comment.