public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Andrew Chernyakov <acherniakov@astralinux.ru>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] dmaengine: fsl-edma: fix potential NULL pointer dereference in fsl_edma_tx_status()
Date: Fri, 4 Nov 2022 20:07:30 +0530	[thread overview]
Message-ID: <Y2UjqrTVMKm1QGmD@matsya> (raw)
In-Reply-To: <20221026101841.35305-1-acherniakov@astralinux.ru>

On 26-10-22, 13:18, Andrew Chernyakov wrote:
> fsl_edma_desc_residue() dereferences fsl_chan->edesc, but it is checked
> for NULL only in one of two places where fsl_edma_desc_residue() is
> called from fsl_edma_tx_status().

Patch subject should be the change it introduces, pls revise

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrew Chernyakov <acherniakov@astralinux.ru>
> ---
>  drivers/dma/fsl-edma-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> index a06a1575a2a5..fb712d85d556 100644
> --- a/drivers/dma/fsl-edma-common.c
> +++ b/drivers/dma/fsl-edma-common.c
> @@ -330,7 +330,7 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan,
>  	if (fsl_chan->edesc && cookie == fsl_chan->edesc->vdesc.tx.cookie)
>  		txstate->residue =
>  			fsl_edma_desc_residue(fsl_chan, vdesc, true);
> -	else if (vdesc)
> +	else if (fsl_chan->edesc && vdesc)
>  		txstate->residue =
>  			fsl_edma_desc_residue(fsl_chan, vdesc, false);
>  	else
> -- 
> 2.35.1

-- 
~Vinod

      reply	other threads:[~2022-11-04 14:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 10:18 [PATCH] dmaengine: fsl-edma: fix potential NULL pointer dereference in fsl_edma_tx_status() Andrew Chernyakov
2022-11-04 14:37 ` Vinod Koul [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=Y2UjqrTVMKm1QGmD@matsya \
    --to=vkoul@kernel.org \
    --cc=acherniakov@astralinux.ru \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.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