From: Rosen Penev <rosenp@gmail.com>
To: dmaengine@vger.kernel.org
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Dan Williams <djbw@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
linux-arm-kernel@lists.infradead.org (moderated list:MICROCHIP
AT91 DMA DRIVERS), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] dmaengine: at_hdmac: fix memory leak in atc_prep_slave_sg
Date: Wed, 22 Jul 2026 22:04:02 -0700 [thread overview]
Message-ID: <20260723050402.272606-1-rosenp@gmail.com> (raw)
The default case in the direction switch returns NULL without freeing
the descriptor allocated earlier via kzalloc_flex(). Add the missing
kfree(desc) before returning.
Fixes: 808347f6a317 ("dmaengine: at_hdmac: add DMA slave transfers")
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/dma/at_hdmac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f9c336630fa2..c06f70dbc4c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1381,6 +1381,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
}
break;
default:
+ kfree(desc);
return NULL;
}
--
2.55.0
next reply other threads:[~2026-07-23 5:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 5:04 Rosen Penev [this message]
2026-07-23 5:16 ` [PATCH] dmaengine: at_hdmac: fix memory leak in atc_prep_slave_sg sashiko-bot
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=20260723050402.272606-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=Frank.Li@kernel.org \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.