split ->file_mmap() into ->mmap_addr()/->mmap_file()
... i.e. file-dependent and address-dependent checks.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/mm/mmap.c b/mm/mmap.c
index 83c5662..49283da 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1101,7 +1101,11 @@
}
}
- error = security_file_mmap(file, reqprot, prot, flags, addr, 0);
+ error = security_mmap_addr(addr);
+ if (error)
+ return error;
+
+ error = security_mmap_file(file, reqprot, prot, flags);
if (error)
return error;
@@ -1817,7 +1821,7 @@
return -ENOMEM;
address &= PAGE_MASK;
- error = security_file_mmap(NULL, 0, 0, 0, address, 1);
+ error = security_mmap_addr(address);
if (error)
return error;
@@ -2205,7 +2209,7 @@
if (!len)
return addr;
- error = security_file_mmap(NULL, 0, 0, 0, addr, 1);
+ error = security_mmap_addr(addr);
if (error)
return error;
@@ -2561,7 +2565,7 @@
vma->vm_ops = &special_mapping_vmops;
vma->vm_private_data = pages;
- ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1);
+ ret = security_mmap_addr(vma->vm_start);
if (ret)
goto out;
diff --git a/mm/mremap.c b/mm/mremap.c
index 169c53b..ebf1089 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -371,7 +371,7 @@
if ((addr <= new_addr) && (addr+old_len) > new_addr)
goto out;
- ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
+ ret = security_mmap_addr(new_addr);
if (ret)
goto out;
@@ -532,7 +532,7 @@
goto out;
}
- ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
+ ret = security_mmap_addr(new_addr);
if (ret)
goto out;
ret = move_vma(vma, addr, old_len, new_len, new_addr);
diff --git a/mm/nommu.c b/mm/nommu.c
index de6084e..acfe419 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1047,7 +1047,10 @@
}
/* allow the security API to have its say */
- ret = security_file_mmap(file, reqprot, prot, flags, addr, 0);
+ ret = security_mmap_addr(addr);
+ if (ret < 0)
+ return ret;
+ ret = security_mmap_file(file, reqprot, prot, flags);
if (ret < 0)
return ret;