Commit 40d442f9 authored by Johan Hovold's avatar Johan Hovold Committed by Luiz Augusto von Dentz

Bluetooth: qca: fix firmware check error path

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: default avatarJohan Hovold <johan+linaro@kernel.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent adf0398c
...@@ -605,7 +605,7 @@ static int qca_download_firmware(struct hci_dev *hdev, ...@@ -605,7 +605,7 @@ static int qca_download_firmware(struct hci_dev *hdev,
ret = qca_tlv_check_data(hdev, config, data, size, soc_type); ret = qca_tlv_check_data(hdev, config, data, size, soc_type);
if (ret) if (ret)
return ret; goto out;
segment = data; segment = data;
remain = size; remain = size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment