From: Kishon Vijay Abraham I <kishon@ti.com>
To: Peter Ujfalusi <peter.ujfalusi@gmail.com>, Vinod Koul <vkoul@kernel.org>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH 1/2] dmaengine: ti: k3-udma: Fix NULL pointer dereference error for BCDMA
Date: Wed, 27 Oct 2021 11:24:52 +0530 [thread overview]
Message-ID: <c4faa3d6-4622-0f82-603e-308c8fd43156@ti.com> (raw)
In-Reply-To: <20211027055254.10912-1-kishon@ti.com>
Hi All,
On 27/10/21 11:22 am, Kishon Vijay Abraham I wrote:
> bcdma_get_*() checks if bchan is already allocated by checking if it
> has a NON NULL value. For the error cases, bchan will have error value
> and bcdma_get_*() considers this as already allocated (PASS) since the
> error values are NON NULL. This results in NULL pointer dereference
> error while de-referencing bchan.
>
> Reset the value of bchan to NULL if the allocation actually fails.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Please ignore this series. There was some stray patches left which I failed to
notice before sending. I'll resend a clean one.
Thanks,
Kishon
> ---
> drivers/dma/ti/k3-udma.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index a35858610780..14ae28830871 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -1348,6 +1348,7 @@ static int bcdma_get_bchan(struct udma_chan *uc)
> {
> struct udma_dev *ud = uc->ud;
> enum udma_tp_level tpl;
> + int ret;
>
> if (uc->bchan) {
> dev_dbg(ud->dev, "chan%d: already have bchan%d allocated\n",
> @@ -1365,8 +1366,11 @@ static int bcdma_get_bchan(struct udma_chan *uc)
> tpl = ud->bchan_tpl.levels - 1;
>
> uc->bchan = __udma_reserve_bchan(ud, tpl, -1);
> - if (IS_ERR(uc->bchan))
> - return PTR_ERR(uc->bchan);
> + if (IS_ERR(uc->bchan)) {
> + ret = PTR_ERR(uc->bchan);
> + uc->bchan = NULL;
> + return ret;
> + }
>
> uc->tchan = uc->bchan;
>
>
prev parent reply other threads:[~2021-10-27 6:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 5:52 Kishon Vijay Abraham I
2021-10-27 5:52 ` [PATCH 2/2] dmaengine: ti: k3-udma: Fix NULL pointer dereference error for PKTDMA Kishon Vijay Abraham I
2021-10-27 5:52 ` [PATCH v2 0/2] dmaengine: ti: k3-udma: Fix NULL pointer dereference error Kishon Vijay Abraham I
2021-10-27 5:52 ` [PATCH v2 1/2] dmaengine: ti: k3-udma: Fix NULL pointer dereference error for BCDMA Kishon Vijay Abraham I
2021-10-27 5:52 ` [PATCH v2 2/2] dmaengine: ti: k3-udma: Fix NULL pointer dereference error for PKTDMA Kishon Vijay Abraham I
2021-10-27 5:54 ` Kishon Vijay Abraham I [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=c4faa3d6-4622-0f82-603e-308c8fd43156@ti.com \
--to=kishon@ti.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.ujfalusi@gmail.com \
--cc=vigneshr@ti.com \
--cc=vkoul@kernel.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®