Subject: CVE-2024-46741: misc: fastrpc: Fix double free of 'buf' in error path

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

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

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

misc: fastrpc: Fix double free of 'buf' in error path

smatch warning:
drivers/misc/fastrpc.c:1926 fastrpc_req_mmap() error: double free of 'buf'

In fastrpc_req_mmap() error path, the fastrpc buffer is freed in
fastrpc_req_munmap_impl() if unmap is successful.

But in the end, there is an unconditional call to fastrpc_buf_free().
So the above case triggers the double free of fastrpc buf.

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

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

	Issue introduced in 6.2 with commit 72fa6f7820c4 and fixed in 6.6.51 with commit f77dc8a75859
	Issue introduced in 6.2 with commit 72fa6f7820c4 and fixed in 6.10.10 with commit bfc1704d909d
	Issue introduced in 6.2 with commit 72fa6f7820c4 and fixed in 6.11 with commit e8c276d4dc0e

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-46741
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/misc/fastrpc.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/f77dc8a75859e559f3238a6d906206259227985e
	https://git.kernel.org/stable/c/bfc1704d909dc9911a558b1a5833d3d61a43a1f2
	https://git.kernel.org/stable/c/e8c276d4dc0e19ee48385f74426aebc855b49aaf