diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index bf92ce7e4e3e..8f101e83caed 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -453,6 +454,9 @@ static long dma_buf_ioctl(struct file *file, if (sync_p.len == 0) return -EINVAL; + if ((sync_p.offset % cache_line_size()) || (sync_p.len % cache_line_size())) + return -EINVAL; + if (sync_p.len > dmabuf->size || sync_p.offset > dmabuf->size - sync_p.len) return -EINVAL;