staging: gasket: don't require all pages to be writable

Buffers to be mapped as DMA_TO_DEVICE must be writable due to the
'write' argument to get_user_pages_fast being hard coded to 1.
This prevents userspace from passing in pointers returned from
mmap(fd, PROT_READ), instead mmap(fd, PROT_READ | PROT_WRITE)
must be used even if the buffer is supposed to be read only.

Instead set writable to non zero iff direction != DMA_TO_DEVICE,
ie only buffers with DMA_FROM_DEVICE or DMA_BIDIRECTIONAL are
required to be writable.

Change-Id: Idaff27ff36075b6a209af0ab9ac3e73ad1b7eaef
Signed-off-by: Jonas Larsson <ljonas@google.com>
1 file changed