]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/nouveau: fix a use-after-free in r535_gsp_rpc_push()
authorZhi Wang <zhiw@nvidia.com>
Tue, 27 May 2025 16:37:12 +0000 (16:37 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 13 Jun 2025 14:38:06 +0000 (16:38 +0200)
commit9802f0a63b641f4cddb2139c814c2e95cb825099
tree517ce810ce225fc53a4571a42b70ffef3bed7994
parent80626ae6ffe57917915c6e6d8ea1e908689954fd
drm/nouveau: fix a use-after-free in r535_gsp_rpc_push()

The RPC container is released after being passed to r535_gsp_rpc_send().

When sending the initial fragment of a large RPC and passing the
caller's RPC container, the container will be freed prematurely. Subsequent
attempts to send remaining fragments will therefore result in a
use-after-free.

Allocate a temporary RPC container for holding the initial fragment of a
large RPC when sending. Free the caller's container when all fragments
are successfully sent.

Fixes: 176fdcbddfd2 ("drm/nouveau/gsp/r535: add support for booting GSP-RM")
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Link: https://lore.kernel.org/r/20250527163712.3444-1-zhiw@nvidia.com
[ Rebase onto Blackwell changes. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c