mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Pavel Sakharov" <p.sakharov@ispras.ru>,
	"Christian König" <christian.koenig@amd.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>,
	Arvind Yadav <Arvind.Yadav@amd.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	Fedor Pchelkin <pchelkin@ispras.ru>,
	lvc-project@linuxtesting.org
Subject: Re: [Linaro-mm-sig] [PATCH] dma-buf: Fix NULL pointer dereference in sanitycheck()
Date: Wed, 20 Mar 2024 09:37:09 +0100	[thread overview]
Message-ID: <57c49fd1-a55f-47d5-a057-54d360c77906@gmail.com> (raw)
In-Reply-To: <20240319231527.1821372-1-p.sakharov@ispras.ru>

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@ispras.ru>

Reviewed-by: Christian König <christian.koenig@amd.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@lists.linaro.org
> To unsubscribe send an email to linaro-mm-sig-leave@lists.linaro.org


      reply	other threads:[~2024-03-20  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 23:15 Pavel Sakharov
2024-03-20  8:37 ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57c49fd1-a55f-47d5-a057-54d360c77906@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Arvind.Yadav@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=p.sakharov@ispras.ru \
    --cc=pchelkin@ispras.ru \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®