Re: [PATCH corrected] firewire: fw-ohci: fix DMA mapping for ar context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wrote:
> The CPU must not touch the buffer after it was DMA-mapped.
> 
> Signed-off-by: Stefan Richter <[email protected]>
> ---
>  drivers/firewire/fw-ohci.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: linux/drivers/firewire/fw-ohci.c
> ===================================================================
> --- linux.orig/drivers/firewire/fw-ohci.c
> +++ linux/drivers/firewire/fw-ohci.c
> @@ -258,6 +258,7 @@ static int ar_context_add_page(struct ar
>  		free_page((unsigned long) ab);
>  		return -ENOMEM;
>  	}
> +	dma_sync_single_for_cpu(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
>  
>  	memset(&ab->descriptor, 0, sizeof(ab->descriptor));
>  	ab->descriptor.control        = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
> 

This is still not complete:

in ar_context_add_page():
	ctx->last_buffer->descriptor.branch_address = ...;

in ar_context_tasklet():
	dma_unmap_single(ohci->card.device,
		le32_to_cpu(ab->descriptor.data_address) - offset,
		PAGE_SIZE, DMA_BIDIRECTIONAL);

They both access DMA-mapped areas.
-- 
Stefan Richter
-=====-=-=== =-=- =----
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux