Subject: CVE-2024-36942: Bluetooth: qca: fix firmware check error path

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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.

The Linux kernel CVE team has assigned CVE-2024-36942 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.15.159 with commit 580bcd6bf24f
	Fixed in 6.1.91 with commit 064688d70c33
	Fixed in 6.6.31 with commit 7bcba557d5c3
	Fixed in 6.8.10 with commit d1f768214320
	Fixed in 6.9 with commit 40d442f969fb

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-36942
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/bluetooth/btqca.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/580bcd6bf24f9975f97d81d5ef1b64cca9240df9
	https://git.kernel.org/stable/c/064688d70c33bb5b49dde6e972b9379a8b045d8a
	https://git.kernel.org/stable/c/7bcba557d5c37cd09ecd5abbe7d50deb86c36d3f
	https://git.kernel.org/stable/c/d1f768214320852766a60a815a0be8f14fba0cc3
	https://git.kernel.org/stable/c/40d442f969fb1e871da6fca73d3f8aef1f888558