aboutsummaryrefslogtreecommitdiffstats
path: root/security/smc/tf_comm.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/smc/tf_comm.c')
-rw-r--r--security/smc/tf_comm.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/security/smc/tf_comm.c b/security/smc/tf_comm.c
index af4cef6..59733f8 100644
--- a/security/smc/tf_comm.c
+++ b/security/smc/tf_comm.c
@@ -208,6 +208,7 @@ struct tf_coarse_page_table *tf_alloc_coarse_page_table(
}
array->type = type;
+ array->ref_count = 0;
INIT_LIST_HEAD(&(array->list));
/* now allocate the actual page the page descriptor describes */
@@ -499,7 +500,7 @@ inline struct page *tf_l2_page_descriptor_to_page(u32 l2_page_descriptor)
*/
static void tf_get_l2_page_descriptor(
u32 *l2_page_descriptor,
- u32 flags, struct mm_struct *mm, struct vm_area_struct *vmas)
+ u32 flags, struct mm_struct *mm)
{
u32 descriptor;
struct page *page;
@@ -511,11 +512,6 @@ static void tf_get_l2_page_descriptor(
if (*l2_page_descriptor == L2_DESCRIPTOR_FAULT)
return;
- if (vmas->vm_flags & VM_IO) {
- *l2_page_descriptor = L2_DESCRIPTOR_FAULT;
- dprintk(KERN_ERR "Memory mapped I/O or similar detected\n");
- return;
- }
page = (struct page *) (*l2_page_descriptor);
descriptor = TF_DEFAULT_COMMON_DESCRIPTORS;
@@ -797,8 +793,7 @@ int tf_fill_descriptor_table(
tf_get_l2_page_descriptor(
&coarse_pg_table->descriptors[j],
flags,
- current->mm,
- vmas[j]);
+ current->mm);
/*
* Reject Strongly-Ordered or Device Memory
*/
@@ -821,18 +816,24 @@ int tf_fill_descriptor_table(
goto error;
}
}
- } else if (is_vmalloc_addr((void *)buffer_offset_vaddr)) {
- /* Kernel-space memory obtained through vmalloc */
+ } else {
+ /* Kernel-space memory */
dprintk(KERN_INFO
"tf_fill_descriptor_table: "
- "vmalloc'ed buffer starting at %p\n",
+ "buffer starting at %p\n",
(void *)buffer_offset_vaddr);
for (j = page_shift; j < pages_to_get; j++) {
struct page *page;
void *addr =
(void *)(buffer_offset_vaddr +
(j - page_shift) * PAGE_SIZE);
- page = vmalloc_to_page(addr);
+
+ if (is_vmalloc_addr(
+ (void *) buffer_offset_vaddr))
+ page = vmalloc_to_page(addr);
+ else
+ page = virt_to_page(addr);
+
if (page == NULL) {
dprintk(KERN_ERR
"tf_fill_descriptor_table: "
@@ -849,20 +850,8 @@ int tf_fill_descriptor_table(
tf_get_l2_page_descriptor(
&coarse_pg_table->descriptors[j],
flags,
- &init_mm,
- vmas[j]);
+ &init_mm);
}
- } else {
- /* Other kernel-space memory */
- dprintk(KERN_INFO
- "tf_fill_descriptor_table: "
- "buffer starting at virtual address %p\n",
- (void *)buffer_offset_vaddr);
- dprintk(KERN_WARNING
- "tf_fill_descriptor_table: "
- "address type not supported\n");
- ret = -ENOSYS;
- goto error;
}
dmac_flush_range((void *)coarse_pg_table->descriptors,