Title: [5798] trunk/arch/blackfin/kernel/bfin_dma_5xx.c: check pointers in safe_dma_memcpy() as this is the entry point for user-space code
- Revision
- 5798
- Author
- vapier
- Date
- 2008-12-03 14:38:34 -0600 (Wed, 03 Dec 2008)
Log Message
check pointers in safe_dma_memcpy() as this is the entry point for user-space code
Modified Paths
Diff
Modified: trunk/arch/blackfin/kernel/bfin_dma_5xx.c (5797 => 5798)
--- trunk/arch/blackfin/kernel/bfin_dma_5xx.c 2008-12-03 20:34:19 UTC (rev 5797)
+++ trunk/arch/blackfin/kernel/bfin_dma_5xx.c 2008-12-03 20:38:34 UTC (rev 5798)
@@ -596,11 +596,18 @@
}
EXPORT_SYMBOL(dma_memcpy);
+/**
+ * safe_dma_memcpy - DMA memcpy w/argument checking
+ *
+ * Verify arguments are safe before heading to dma_memcpy().
+ */
void *safe_dma_memcpy(void *dest, const void *src, size_t size)
{
- void *addr;
- addr = dma_memcpy(dest, src, size);
- return addr;
+ if (!access_ok(VERIFY_WRITE, dst, size))
+ return NULL;
+ if (!access_ok(VERIFY_READ, src, size))
+ return NULL;
+ return dma_memcpy(dst, src, size);
}
EXPORT_SYMBOL(safe_dma_memcpy);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits