public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: tmio: fix address in kunmap_atomic() calls
@ 2011-03-11  7:30 Guennadi Liakhovetski
  2011-03-14 22:12 ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-11  7:30 UTC (permalink / raw)
  To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton

Currently kunmap_atomic() doesn't take into account the offset, used
with kmap_atomic(). On platforms, where kunmap_atomic() is not a NOP,
this will lead to problems, when offset != 0.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

No, I've never seen this bug trigger, so, not sure whether we need it for 
.38 / stable.

 drivers/mmc/host/tmio_mmc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 986f902..32ab145 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -222,9 +222,9 @@ static char *tmio_mmc_kmap_atomic(struct scatterlist *sg, unsigned long *flags)
 	return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;
 }
 
-static void tmio_mmc_kunmap_atomic(void *virt, unsigned long *flags)
+static void tmio_mmc_kunmap_atomic(struct scatterlist *sg, unsigned long *flags, void *virt)
 {
-	kunmap_atomic(virt, KM_BIO_SRC_IRQ);
+	kunmap_atomic(virt - sg->offset, KM_BIO_SRC_IRQ);
 	local_irq_restore(*flags);
 }
 
@@ -516,7 +516,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
 
 	host->sg_off += count;
 
-	tmio_mmc_kunmap_atomic(sg_virt, &flags);
+	tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt);
 
 	if (host->sg_off == host->sg_ptr->length)
 		tmio_mmc_next_sg(host);
@@ -774,7 +774,7 @@ static void tmio_check_bounce_buffer(struct tmio_mmc_host *host)
 		unsigned long flags;
 		void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags);
 		memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length);
-		tmio_mmc_kunmap_atomic(sg_vaddr, &flags);
+		tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr);
 	}
 }
 
@@ -898,7 +898,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
 		void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags);
 		sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);
 		memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length);
-		tmio_mmc_kunmap_atomic(sg_vaddr, &flags);
+		tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr);
 		host->sg_ptr = &host->bounce_sg;
 		sg = host->sg_ptr;
 	}
-- 
1.7.2.3


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

* Re: [PATCH] mmc: tmio: fix address in kunmap_atomic() calls
  2011-03-11  7:30 [PATCH] mmc: tmio: fix address in kunmap_atomic() calls Guennadi Liakhovetski
@ 2011-03-14 22:12 ` Chris Ball
  2011-03-14 22:54   ` Guennadi Liakhovetski
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Ball @ 2011-03-14 22:12 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-sh, linux-mmc, Ian Molton

Hi Guennadi,

On Fri, Mar 11 2011, Guennadi Liakhovetski wrote:
> Currently kunmap_atomic() doesn't take into account the offset, used
> with kmap_atomic(). On platforms, where kunmap_atomic() is not a NOP,
> this will lead to problems, when offset != 0.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> No, I've never seen this bug trigger, so, not sure whether we need it for 
> .38 / stable.

Thanks, I've pushed this to mmc-next for .39.

Could I get your ACK on the sh/tmio patches in Linus W's "[PATCH 00/11]
MMC DMA-API/dmaengine fixups" patchset, please?

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH] mmc: tmio: fix address in kunmap_atomic() calls
  2011-03-14 22:12 ` Chris Ball
@ 2011-03-14 22:54   ` Guennadi Liakhovetski
  2011-03-18 20:35     ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-14 22:54 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-sh, linux-mmc, Ian Molton

Hi Chris

On Mon, 14 Mar 2011, Chris Ball wrote:

> Hi Guennadi,
> 
> On Fri, Mar 11 2011, Guennadi Liakhovetski wrote:
> > Currently kunmap_atomic() doesn't take into account the offset, used
> > with kmap_atomic(). On platforms, where kunmap_atomic() is not a NOP,
> > this will lead to problems, when offset != 0.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> >
> > No, I've never seen this bug trigger, so, not sure whether we need it for 
> > .38 / stable.
> 
> Thanks, I've pushed this to mmc-next for .39.
> 
> Could I get your ACK on the sh/tmio patches in Linus W's "[PATCH 00/11]
> MMC DMA-API/dmaengine fixups" patchset, please?

Hm, I've looked at them briefly and nothing in them struck me in them, but 
if you want a formal reviewed-by or such I'll have to look at them in more 
detail. I'm away from tomorrow until Saturday at a V4L2 meeting, so, will 
have little time... I'll try to do that, but, will not be able to test 
them. So, either just a review this week or a review + test not before 
next weekend, sorry.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

* Re: [PATCH] mmc: tmio: fix address in kunmap_atomic() calls
  2011-03-14 22:54   ` Guennadi Liakhovetski
@ 2011-03-18 20:35     ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-03-18 20:35 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-sh, linux-mmc, Ian Molton

Hi Guennadi,

On Mon, Mar 14 2011, Guennadi Liakhovetski wrote:
> Hm, I've looked at them briefly and nothing in them struck me in them, but 
> if you want a formal reviewed-by or such I'll have to look at them in more 
> detail. I'm away from tomorrow until Saturday at a V4L2 meeting, so, will 
> have little time... I'll try to do that, but, will not be able to test 
> them. So, either just a review this week or a review + test not before 
> next weekend, sorry.

Okay.  I'll put them in with the .39 merge; they've been in -next for a
while, are hopefully low-risk, and we can always revert later before .39
releases.

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2011-03-18 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11  7:30 [PATCH] mmc: tmio: fix address in kunmap_atomic() calls Guennadi Liakhovetski
2011-03-14 22:12 ` Chris Ball
2011-03-14 22:54   ` Guennadi Liakhovetski
2011-03-18 20:35     ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox