summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSharif Inamdar <isharif@nvidia.com>2013-12-31 17:10:30 +0530
committerVarun Wadekar <vwadekar@nvidia.com>2014-01-03 05:56:11 -0800
commitf4a063081552617e72cbdda5596ae7bd537696f7 (patch)
tree5b4026fe402a357ed25e1225739ce5863ab71ed6
parent592617a72fa2ce6a1693858e7b619dcb5db5b6a5 (diff)
security: tlk_driver: delete te_pin_user_pages() and its usage
te_pin_user_pages() maps user pages, but the mapped pages never get used. Bug 1430582 Change-Id: I2d815f1d970e491058cf89cc9fef0f78b8e9764c Signed-off-by: Sharif Inamdar <isharif@nvidia.com> Reviewed-on: http://git-master/r/351021 (cherry picked from commit 7ac517f2203a41ffa4f703d9b18c46a8558873e0) Reviewed-on: http://git-master/r/351670 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com>
-rw-r--r--security/tlk_driver/ote_comms.c46
-rw-r--r--security/tlk_driver/ote_protocol.h4
2 files changed, 3 insertions, 47 deletions
diff --git a/security/tlk_driver/ote_comms.c b/security/tlk_driver/ote_comms.c
index 3fb5e035965a..8cb11a288f6b 100644
--- a/security/tlk_driver/ote_comms.c
+++ b/security/tlk_driver/ote_comms.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2014 NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,35 +34,7 @@ core_param(verbose_smc, verbose_smc, bool, 0644);
#define SET_RESULT(req, r, ro) { req->result = r; req->result_origin = ro; }
-static int te_pin_user_pages(void *buffer, size_t size,
- unsigned long *pages_ptr)
-{
- int ret = 0;
- unsigned int nr_pages;
- struct page **pages = NULL;
-
- nr_pages = (((unsigned int)buffer & (PAGE_SIZE - 1)) +
- (size + PAGE_SIZE - 1)) >> PAGE_SHIFT;
-
- pages = kzalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
- if (!pages)
- return -ENOMEM;
-
- down_read(&current->mm->mmap_sem);
- ret = get_user_pages(current, current->mm, (unsigned long)buffer,
- nr_pages, WRITE, 0, pages, NULL);
- if (ret < 0)
- ret = get_user_pages(current, current->mm, (unsigned long)buffer,
- nr_pages, WRITE, 1/*force*/, pages, NULL);
- up_read(&current->mm->mmap_sem);
-
- *pages_ptr = (unsigned long) pages;
-
- return ret;
-}
-
static struct te_shmem_desc *te_add_shmem_desc(void *buffer, size_t size,
- unsigned int nr_pages, struct page **pages,
struct tlk_context *context)
{
struct te_shmem_desc *shmem_desc = NULL;
@@ -71,8 +43,6 @@ static struct te_shmem_desc *te_add_shmem_desc(void *buffer, size_t size,
INIT_LIST_HEAD(&(shmem_desc->list));
shmem_desc->buffer = buffer;
shmem_desc->size = size;
- shmem_desc->nr_pages = nr_pages;
- shmem_desc->pages = pages;
list_add_tail(&shmem_desc->list, &(context->shmem_alloc_list));
}
@@ -87,16 +57,7 @@ static int te_pin_mem_buffers(void *buffer, size_t size,
struct te_shmem_desc *shmem_desc = NULL;
int ret = 0, nr_pages = 0;
- nr_pages = te_pin_user_pages(buffer, size, &pages);
- if (nr_pages <= 0) {
- pr_err("%s: te_pin_user_pages Failed (%d)\n", __func__,
- nr_pages);
- ret = OTE_ERROR_OUT_OF_MEMORY;
- goto error;
- }
-
- shmem_desc = te_add_shmem_desc(buffer, size,
- nr_pages, (struct page **)pages, context);
+ shmem_desc = te_add_shmem_desc(buffer, size, context);
if (!shmem_desc) {
pr_err("%s: te_add_shmem_desc Failed\n", __func__);
ret = OTE_ERROR_OUT_OF_MEMORY;
@@ -152,9 +113,6 @@ static void te_del_shmem_desc(void *buffer, struct tlk_context *context)
&(context->shmem_alloc_list), list) {
if (shmem_desc->buffer == buffer) {
list_del(&shmem_desc->list);
- for (i = 0; i < shmem_desc->nr_pages; i++)
- page_cache_release(shmem_desc->pages[i]);
- kfree(shmem_desc->pages);
kfree(shmem_desc);
}
}
diff --git a/security/tlk_driver/ote_protocol.h b/security/tlk_driver/ote_protocol.h
index 74214517bba1..cff135dce349 100644
--- a/security/tlk_driver/ote_protocol.h
+++ b/security/tlk_driver/ote_protocol.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2014 NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -112,8 +112,6 @@ struct te_shmem_desc {
void *buffer;
size_t size;
unsigned int mem_type;
- struct page **pages;
- unsigned int nr_pages;
};
struct tlk_context {