diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2013-12-03 12:37:11 +0530 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2013-12-07 03:38:57 -0800 |
commit | 82fbaaf0944f86b37ec38a39504ab12d7eab99fa (patch) | |
tree | 8343caef743c5edc9f0af197ff61ea47422aaddd /security | |
parent | 4d8eee2146fbf8e4a3254ba72debe4cd89671bfd (diff) |
security: tlk_driver: forcibly map user pages if default mapping fails
There are instances when te_pin_user_pages() fails due to failure in
get_user_pages(). We use default mapping policy to get user pages
before pinning. But if default fails, then try using "force" option to
map user pages.
Bug 1412144
Bug 1176001
Change-Id: I661a15c86846816a8050ddfda7b58711c31f7aa5
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/338755
Diffstat (limited to 'security')
-rw-r--r-- | security/tlk_driver/ote_comms.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/security/tlk_driver/ote_comms.c b/security/tlk_driver/ote_comms.c index 9355d07dbb62..3fb5e035965a 100644 --- a/security/tlk_driver/ote_comms.c +++ b/security/tlk_driver/ote_comms.c @@ -51,6 +51,9 @@ static int te_pin_user_pages(void *buffer, size_t size, down_read(¤t->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(¤t->mm->mmap_sem); *pages_ptr = (unsigned long) pages; @@ -86,7 +89,8 @@ static int te_pin_mem_buffers(void *buffer, size_t size, nr_pages = te_pin_user_pages(buffer, size, &pages); if (nr_pages <= 0) { - pr_err("%s: te_pin_user_pages Failed\n", __func__); + pr_err("%s: te_pin_user_pages Failed (%d)\n", __func__, + nr_pages); ret = OTE_ERROR_OUT_OF_MEMORY; goto error; } |