summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/operation.h
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-04-07 11:27:17 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-07 17:31:05 +0200
commit1e5613b4a673f0670b64fe24f1c987604403e8c1 (patch)
treeac6ce9f410799c307a5800fa434a48a8c6f4e374 /drivers/staging/greybus/operation.h
parent7cf7bca9ec5659efa9520ffc5a3ff4ef59383560 (diff)
greybus: operation: fix potential message corruption
Make sure to allocate the message transfer-buffer separately from the containing message structure to avoid data corruption on systems without DMA-coherent caches. The message structure contains state that is updated while the buffer may be used for DMA, something which could lead to data corruption due to cache-line sharing on some architectures. Use the (renamed) message cache for the message structure itself and allocate the buffer separately. If the additional allocation is a concern, the message structures could eventually be allocated as part of the operation structure. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.h')
-rw-r--r--drivers/staging/greybus/operation.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h
index cbd347c6b427..647e0bfc54ee 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -82,7 +82,7 @@ struct gb_message {
void *payload;
size_t payload_size;
- u8 buffer[];
+ void *buffer;
};
/*