security: tlk_driver: allocate uncached memory for FS operations
Varun Wadekar [Fri, 6 Dec 2013 11:49:09 +0000 (16:49 +0530)]
Bug 1412144
Bug 1176001

Change-Id: If68806ee44a7009354efdda3d5cbf9e0e1f5f47f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/339205

security/tlk_driver/ote_fs.c

index cf02e8c..b43eae6 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
+#include <linux/dma-mapping.h>
 
 #include "ote_protocol.h"
 
@@ -200,13 +201,17 @@ static int __init tlk_fs_register_handlers(void)
 {
        struct te_file_req_shmem *shmem_ptr;
        uint32_t smc_args[MAX_EXT_SMC_ARGS];
+       dma_addr_t shmem_dma;
 
-       shmem_ptr = kzalloc(sizeof(struct te_file_req_shmem), GFP_KERNEL);
+       shmem_ptr = dma_alloc_coherent(NULL, sizeof(struct te_file_req_shmem),
+                       &shmem_dma, GFP_KERNEL);
        if (!shmem_ptr) {
                pr_err("%s: no memory available for fs operations\n", __func__);
                return -ENOMEM;
        }
 
+       memset(shmem_ptr, 0, sizeof(struct te_file_req_shmem));
+
        INIT_LIST_HEAD(&req_list);
        init_completion(&req_ready);
        init_completion(&req_complete);