mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541
@ 2009-03-31 16:07 Guennadi Liakhovetski
  2009-03-31 16:33 ` Dan Williams
  2009-04-01  1:21 ` Atsushi Nemoto
  0 siblings, 2 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2009-03-31 16:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Atsushi Nemoto, Dan Williams, Maciej Sosnowski

chan is an index variable, used to loop over a list of channels, and here 
it is used _after_ the loop, in which case it doesn't point to a DMA 
channel struct anymore. Dereferencing it leads to a corruption of a random 
memory location, which in my case was a pointer inside a clock struct. Fix 
it by using a local variable pointing to the DMA device.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
---

Guys, this was a _real_ bad joke, cost me almost a day, and that patch has 
been reviewed by two persons...

<rant>
So far 2.6.29(-next) has been very bad for me, regressions all over the 
place, lots of wasted time hunting them down:-(
</rant>

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 59e0fb2..92438e9 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -726,7 +726,7 @@ int dma_async_device_register(struct dma_device *device)
 		}
 	list_add_tail_rcu(&device->global_node, &dma_device_list);
 	if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
-		chan->device->privatecnt++;	/* Always private */
+		device->privatecnt++;	/* Always private */
 	dma_channel_rebalance();
 	mutex_unlock(&dma_list_mutex);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541
  2009-03-31 16:07 [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541 Guennadi Liakhovetski
@ 2009-03-31 16:33 ` Dan Williams
  2009-04-01  1:21 ` Atsushi Nemoto
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2009-03-31 16:33 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-kernel, Atsushi Nemoto, Sosnowski, Maciej

Guennadi Liakhovetski wrote:
> chan is an index variable, used to loop over a list of channels, and here 
> it is used _after_ the loop, in which case it doesn't point to a DMA 
> channel struct anymore. Dereferencing it leads to a corruption of a random 
> memory location, which in my case was a pointer inside a clock struct. Fix 
> it by using a local variable pointing to the DMA device.
> 
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> ---
> 
> Guys, this was a _real_ bad joke, cost me almost a day, and that patch has 
> been reviewed by two persons...
> 
> <rant>
> So far 2.6.29(-next) has been very bad for me, regressions all over the 
> place, lots of wasted time hunting them down:-(
> </rant>
> 

Guennadi,

Thanks for testing the 'next' branch and finding this before it hit 
mainline.  I will fold this change into the existing commit with a 
[lg@denx.de: fix bad usage of 'chan' in dma_async_device_register]

Regards,
Dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541
  2009-03-31 16:07 [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541 Guennadi Liakhovetski
  2009-03-31 16:33 ` Dan Williams
@ 2009-04-01  1:21 ` Atsushi Nemoto
  1 sibling, 0 replies; 3+ messages in thread
From: Atsushi Nemoto @ 2009-04-01  1:21 UTC (permalink / raw)
  To: lg; +Cc: linux-kernel, dan.j.williams, maciej.sosnowski

On Tue, 31 Mar 2009 18:07:34 +0200 (CEST), Guennadi Liakhovetski <lg@denx.de> wrote:
> chan is an index variable, used to loop over a list of channels, and here 
> it is used _after_ the loop, in which case it doesn't point to a DMA 
> channel struct anymore. Dereferencing it leads to a corruption of a random 
> memory location, which in my case was a pointer inside a clock struct. Fix 
> it by using a local variable pointing to the DMA device.
> 
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

Oops!  your fix is correct.  Thank you for fixing this nasty bug.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-01  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 16:07 [PATCH] dmaengine: fix regression introduced by d6103085dfd83c13db65c3bd7e182f021d77c541 Guennadi Liakhovetski
2009-03-31 16:33 ` Dan Williams
2009-04-01  1:21 ` Atsushi Nemoto

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®