Commit 49946e73 authored by Mike Frysinger's avatar Mike Frysinger Committed by Bryan Wu

Blackfin arch: check pointers in safe_dma_memcpy

Check pointers in safe_dma_memcpy as this is the entry point for user-space code
Signed-off-by: default avatarMike Frysinger <vapier.adi@gmail.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent c9e0020d
...@@ -596,11 +596,18 @@ void *dma_memcpy(void *dest, const void *src, size_t size) ...@@ -596,11 +596,18 @@ void *dma_memcpy(void *dest, const void *src, size_t size)
} }
EXPORT_SYMBOL(dma_memcpy); 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 *safe_dma_memcpy(void *dest, const void *src, size_t size)
{ {
void *addr; if (!access_ok(VERIFY_WRITE, dst, size))
addr = dma_memcpy(dest, src, size); return NULL;
return addr; if (!access_ok(VERIFY_READ, src, size))
return NULL;
return dma_memcpy(dst, src, size);
} }
EXPORT_SYMBOL(safe_dma_memcpy); EXPORT_SYMBOL(safe_dma_memcpy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment