[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57c49fd1-a55f-47d5-a057-54d360c77906@gmail.com>
Date: Wed, 20 Mar 2024 09:37:09 +0100
From: Christian König <ckoenig.leichtzumerken@...il.com>
To: Pavel Sakharov <p.sakharov@...ras.ru>,
Christian König <christian.koenig@....com>
Cc: Sumit Semwal <sumit.semwal@...aro.org>,
Arvind Yadav <Arvind.Yadav@....com>, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
linux-kernel@...r.kernel.org, Fedor Pchelkin <pchelkin@...ras.ru>,
lvc-project@...uxtesting.org
Subject: Re: [Linaro-mm-sig] [PATCH] dma-buf: Fix NULL pointer dereference in
sanitycheck()
Am 20.03.24 um 00:15 schrieb Pavel Sakharov:
> 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@...ras.ru>
Reviewed-by: Christian König <christian.koenig@....com>
Going to push it to drm-misc-fixes in a minute.
Thanks,
Christian.
>
> ---
> drivers/dma-buf/st-dma-fence-chain.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma-buf/st-dma-fence-chain.c b/drivers/dma-buf/st-dma-fence-chain.c
> index 9c2a0c082a76..ed4b323886e4 100644
> --- a/drivers/dma-buf/st-dma-fence-chain.c
> +++ b/drivers/dma-buf/st-dma-fence-chain.c
> @@ -84,11 +84,11 @@ static int sanitycheck(void *arg)
> return -ENOMEM;
>
> chain = mock_chain(NULL, f, 1);
> - if (!chain)
> + if (chain)
> + dma_fence_enable_sw_signaling(chain);
> + else
> err = -ENOMEM;
>
> - dma_fence_enable_sw_signaling(chain);
> -
> dma_fence_signal(f);
> dma_fence_put(f);
>
> --
> 2.44.0
>
> _______________________________________________
> Linaro-mm-sig mailing list -- linaro-mm-sig@...ts.linaro.org
> To unsubscribe send an email to linaro-mm-sig-leave@...ts.linaro.org
Powered by blists - more mailing lists