aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 1d32fe89d57b..ef8c62cec697 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -966,8 +966,13 @@ unsigned long do_mmap_pgoff(struct file *file,
966 966
967 INIT_LIST_HEAD(&vma->anon_vma_node); 967 INIT_LIST_HEAD(&vma->anon_vma_node);
968 atomic_set(&vma->vm_usage, 1); 968 atomic_set(&vma->vm_usage, 1);
969 if (file) 969 if (file) {
970 get_file(file); 970 get_file(file);
971 if (vm_flags & VM_EXECUTABLE) {
972 added_exe_file_vma(current->mm);
973 vma->vm_mm = current->mm;
974 }
975 }
971 vma->vm_file = file; 976 vma->vm_file = file;
972 vma->vm_flags = vm_flags; 977 vma->vm_flags = vm_flags;
973 vma->vm_start = addr; 978 vma->vm_start = addr;
@@ -1022,8 +1027,11 @@ unsigned long do_mmap_pgoff(struct file *file,
1022 up_write(&nommu_vma_sem); 1027 up_write(&nommu_vma_sem);
1023 kfree(vml); 1028 kfree(vml);
1024 if (vma) { 1029 if (vma) {
1025 if (vma->vm_file) 1030 if (vma->vm_file) {
1026 fput(vma->vm_file); 1031 fput(vma->vm_file);
1032 if (vma->vm_flags & VM_EXECUTABLE)
1033 removed_exe_file_vma(vma->vm_mm);
1034 }
1027 kfree(vma); 1035 kfree(vma);
1028 } 1036 }
1029 return ret; 1037 return ret;
@@ -1053,7 +1061,7 @@ EXPORT_SYMBOL(do_mmap_pgoff);
1053/* 1061/*
1054 * handle mapping disposal for uClinux 1062 * handle mapping disposal for uClinux
1055 */ 1063 */
1056static void put_vma(struct vm_area_struct *vma) 1064static void put_vma(struct mm_struct *mm, struct vm_area_struct *vma)
1057{ 1065{
1058 if (vma) { 1066 if (vma) {
1059 down_write(&nommu_vma_sem); 1067 down_write(&nommu_vma_sem);
@@ -1075,8 +1083,11 @@ static void put_vma(struct vm_area_struct *vma)
1075 realalloc -= kobjsize(vma); 1083 realalloc -= kobjsize(vma);
1076 askedalloc -= sizeof(*vma); 1084 askedalloc -= sizeof(*vma);
1077 1085
1078 if (vma->vm_file) 1086 if (vma->vm_file) {
1079 fput(vma->vm_file); 1087 fput(vma->vm_file);
1088 if (vma->vm_flags & VM_EXECUTABLE)
1089 removed_exe_file_vma(mm);
1090 }
1080 kfree(vma); 1091 kfree(vma);
1081 } 1092 }
1082 1093
@@ -1113,7 +1124,7 @@ int do_munmap(struct mm_struct *mm, unsigned long addr, size_t len)
1113 found: 1124 found:
1114 vml = *parent; 1125 vml = *parent;
1115 1126
1116 put_vma(vml->vma); 1127 put_vma(mm, vml->vma);
1117 1128
1118 *parent = vml->next; 1129 *parent = vml->next;
1119 realalloc -= kobjsize(vml); 1130 realalloc -= kobjsize(vml);
@@ -1158,7 +1169,7 @@ void exit_mmap(struct mm_struct * mm)
1158 1169
1159 while ((tmp = mm->context.vmlist)) { 1170 while ((tmp = mm->context.vmlist)) {
1160 mm->context.vmlist = tmp->next; 1171 mm->context.vmlist = tmp->next;
1161 put_vma(tmp->vma); 1172 put_vma(mm, tmp->vma);
1162 1173
1163 realalloc -= kobjsize(tmp); 1174 realalloc -= kobjsize(tmp);
1164 askedalloc -= sizeof(*tmp); 1175 askedalloc -= sizeof(*tmp);