Message ID | 20131230204839.45aab6a7@spike (mailing list archive) |
---|---|
State | Accepted |
Commit | e3ddc9794651 |
Delegated to: | Vinod Koul |
Headers | show |
On Mon, Dec 30, 2013 at 08:48:39PM +0100, Christian Engelmayer wrote: > Fix a memory leak in the edma_prep_dma_cyclic() error handling path. > > Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Both are already fixed upstream and availble in -next, which tree was this generated against? -- ~Vinod > --- > This patch fixes an issue introduced in > > commit 50a9c70714dfb17a85a3fb762675a64f598d504b > Author: Joel Fernandes <joelf@ti.com> > Date: Thu Oct 31 16:31:23 2013 -0500 > > dma: edma: Add support for Cyclic DMA > --- > drivers/dma/edma.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c > index 2539ea0..420450e 100644 > --- a/drivers/dma/edma.c > +++ b/drivers/dma/edma.c > @@ -539,6 +539,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( > edma_alloc_slot(EDMA_CTLR(echan->ch_num), > EDMA_SLOT_ANY); > if (echan->slot[i] < 0) { > + kfree(edesc); > dev_err(dev, "Failed to allocate slot\n"); > return NULL; > } > @@ -553,8 +554,10 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( > ret = edma_config_pset(chan, &edesc->pset[i], src_addr, > dst_addr, burst, dev_width, period_len, > direction); > - if (ret < 0) > + if (ret < 0) { > + kfree(edesc); > return NULL; > + } > > if (direction == DMA_DEV_TO_MEM) > dst_addr += period_len; > -- > 1.8.3.2 > -- > To unsubscribe from this list: send the line "unsubscribe dmaengine" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 20 Jan 2014 15:02:00 +0530, Vinod Koul <vinod.koul@intel.com> wrote: > On Mon, Dec 30, 2013 at 08:48:39PM +0100, Christian Engelmayer wrote: > > Fix a memory leak in the edma_prep_dma_cyclic() error handling path. > > > > Signed-off-by: Christian Engelmayer <cengelma@gmx.at> > > Both are already fixed upstream and availble in -next, which tree was this > generated against? The patch was originally generated against mainline and verified against linux-next as well as git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine.git git.infradead.org/users/vkoul/slave-dma.git I can see those 2 issues fixed in function edma_prep_slave_sg() about a week before the introduction of edma_prep_dma_cyclic() that this patch aims at and that seems to incorporate the same error pattern. I currently still see the defect in function edma_prep_dma_cyclic() in -next. Am I really looking at the wrong tree? Regards, Christian -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 20, 2014 at 09:39:32PM +0100, Christian Engelmayer wrote: > On Mon, 20 Jan 2014 15:02:00 +0530, Vinod Koul <vinod.koul@intel.com> wrote: > > On Mon, Dec 30, 2013 at 08:48:39PM +0100, Christian Engelmayer wrote: > > > Fix a memory leak in the edma_prep_dma_cyclic() error handling path. > > > > > > Signed-off-by: Christian Engelmayer <cengelma@gmx.at> > > > > Both are already fixed upstream and availble in -next, which tree was this > > generated against? > > The patch was originally generated against mainline and verified against > linux-next as well as > > git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine.git > git.infradead.org/users/vkoul/slave-dma.git > > I can see those 2 issues fixed in function edma_prep_slave_sg() about a week > before the introduction of edma_prep_dma_cyclic() that this patch aims at > and that seems to incorporate the same error pattern. > > I currently still see the defect in function edma_prep_dma_cyclic() in -next. > Am I really looking at the wrong tree? My bad, I mistook it for similar fixes done in prep_sg. I have applied this now Thanks
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 2539ea0..420450e 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -539,6 +539,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( edma_alloc_slot(EDMA_CTLR(echan->ch_num), EDMA_SLOT_ANY); if (echan->slot[i] < 0) { + kfree(edesc); dev_err(dev, "Failed to allocate slot\n"); return NULL; } @@ -553,8 +554,10 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( ret = edma_config_pset(chan, &edesc->pset[i], src_addr, dst_addr, burst, dev_width, period_len, direction); - if (ret < 0) + if (ret < 0) { + kfree(edesc); return NULL; + } if (direction == DMA_DEV_TO_MEM) dst_addr += period_len;
Fix a memory leak in the edma_prep_dma_cyclic() error handling path. Signed-off-by: Christian Engelmayer <cengelma@gmx.at> --- This patch fixes an issue introduced in commit 50a9c70714dfb17a85a3fb762675a64f598d504b Author: Joel Fernandes <joelf@ti.com> Date: Thu Oct 31 16:31:23 2013 -0500 dma: edma: Add support for Cyclic DMA --- drivers/dma/edma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)