diff options
| author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2015-02-12 21:28:07 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:04:25 -0700 |
| commit | 19cf289669e8dc5f76f8a562339f7d64c9ed2cf6 (patch) | |
| tree | 27c9cf3dc6a54d7e1dcc3cac13d7e763d44d8f23 /include/uapi/linux/ppdev.h | |
| parent | c56415c3b1cc3dfcee4ff7be3384bbdf931bb5d3 (diff) | |
ion: return a fresh sg_table from ion_map_dma_buf
DMA mappers often (always?) modify the scatterlist they are
given (e.g. dma_address and dma_length) when their dma_map_ops.map_sg
operation is called. Currently Ion always returns the same sg_table
when it's dma_buf_ops.map_dma_buf operation is called. The result is
that when Ion is used as a DMA buf exporter to multiple clients (a
common scenario during zero-copy buffer-sharing) those clients will be
stomping all over each other since they're both trying to put their
mappings into the same sg_table.
Fix this by always duplicating the buffer's sg_table in ion_map_dma_buf
and returning the duplicate. Each buffer will still always have a
single "master" sg_table that should never be exported to the DMA buf
framework.
Test case (pseudo-code):
handle = ion_alloc();
dbuf = ion_share_dma_buf(handle);
attach = dma_buf_attach(dbuf);
table1 = dma_buf_map_attachment(attach);
table2 = dma_buf_map_attachment(attach);
dma_map_sg(table1);
table2 = dma_buf_map_attachment(attach);
dma_map_sg(table2);
/* table1 is now hosed */
check_mappings(table1); /* KABOOM */
Change-Id: Ifefa06ecd464c00819b4ae7ac32ad37f1491373b
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'include/uapi/linux/ppdev.h')
0 files changed, 0 insertions, 0 deletions
