summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTri Vo <trong@google.com>2022-03-16 11:26:01 -0700
committerWill McVicker <willmcvicker@google.com>2022-04-22 10:48:01 -0700
commit2100a8b61eb49ab5426003a5040283c95810be67 (patch)
tree88d277343f27e48a2e0571857673499da0188914
parent915d6d62bd0e8e6331bd7d27610d6afe75ab0c58 (diff)
downloadtrusty-2100a8b61eb49ab5426003a5040283c95810be67.tar.gz
ANDROID: trusty: Enforce only TRUSTY_SEND_SECURE can send secure memory
Bug: 224563842 Change-Id: I4a782404993f333e6882a9d30a85116e0f0ebec5 Signed-off-by: Tri Vo <trong@google.com> (cherry picked from commit 07055bfd3d810d41a38354693dfaa55a6f8c0025) Signed-off-by: Will McVicker <willmcvicker@google.com>
-rw-r--r--drivers/trusty/trusty-ipc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/trusty/trusty-ipc.c b/drivers/trusty/trusty-ipc.c
index 5b37237..a30e02a 100644
--- a/drivers/trusty/trusty-ipc.c
+++ b/drivers/trusty/trusty-ipc.c
@@ -1195,13 +1195,16 @@ static int dn_share_fd(struct tipc_dn_chan *dn, int fd,
/*
* Buffers with a preallocated mem_id should only be sent to Trusty
* using TRUSTY_SEND_SECURE. And conversely, TRUSTY_SEND_SECURE should
- * only be used to send buffers with preallcoated mem_id.
+ * only be used to send buffers with preallocated mem_id.
*/
if (!ret) {
/* Use shared memory ID owned by dma_buf */
- /* TODO: Enforce transfer_kind == TRUSTY_SEND_SECURE */
- WARN_ONCE(transfer_kind != TRUSTY_SEND_SECURE,
- "Use TRUSTY_SEND_SECURE instead");
+ if (transfer_kind != TRUSTY_SEND_SECURE) {
+ dev_err(dev, "transfer_kind: %d, must be TRUSTY_SEND_SECURE\n",
+ transfer_kind);
+ ret = -EINVAL;
+ goto cleanup_handle;
+ }
goto mem_id_allocated;
}