]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dma-buf: Fix NULL pointer dereference in sanitycheck()
authorPavel Sakharov <p.sakharov@ispras.ru>
Tue, 19 Mar 2024 23:15:23 +0000 (04:15 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:40 +0000 (16:35 +0200)
commit156c226cbbdcf5f3bce7b2408a33b59fab7fae2c
treecf35b1a04d4e23a469b1b9e0cd0cb0079cd81828
parentaeecb678ec369d888b90d4a4dae9871fd8e56ae8
dma-buf: Fix NULL pointer dereference in sanitycheck()

[ Upstream commit 2295bd846765c766701e666ed2e4b35396be25e6 ]

If due to a memory allocation failure mock_chain() returns NULL, it is
passed to dma_fence_enable_sw_signaling() resulting in NULL pointer
dereference there.

Call dma_fence_enable_sw_signaling() only if mock_chain() succeeds.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: d62c43a953ce ("dma-buf: Enable signaling on fence for selftests")
Signed-off-by: Pavel Sakharov <p.sakharov@ispras.ru>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240319231527.1821372-1-p.sakharov@ispras.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma-buf/st-dma-fence-chain.c