patch-2.4.6 linux/arch/arm/kernel/sys_arm.c
Next file: linux/arch/arm/kernel/traps.c
Previous file: linux/arch/arm/kernel/fiq.c
Back to the patch index
Back to the overall index
- Lines: 51
- Date:
Wed Jun 27 14:12:04 2001
- Orig file:
v2.4.5/linux/arch/arm/kernel/sys_arm.c
- Orig date:
Mon Mar 19 12:35:10 2001
diff -u --recursive --new-file v2.4.5/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
@@ -55,10 +55,19 @@
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
- int error = -EBADF;
+ int error = -EINVAL;
struct file * file = NULL;
flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+
+ /*
+ * If we are doing a fixed mapping, and address < PAGE_SIZE,
+ * then deny it.
+ */
+ if (flags & MAP_FIXED && addr < PAGE_SIZE && vectors_base() == 0)
+ goto out;
+
+ error = -EBADF;
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
@@ -99,6 +108,29 @@
error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
out:
return error;
+}
+
+asmlinkage unsigned long
+sys_arm_mremap(unsigned long addr, unsigned long old_len,
+ unsigned long new_len, unsigned long flags,
+ unsigned long new_addr)
+{
+ unsigned long ret = -EINVAL;
+
+ /*
+ * If we are doing a fixed mapping, and address < PAGE_SIZE,
+ * then deny it.
+ */
+ if (flags & MREMAP_FIXED && new_addr < PAGE_SIZE &&
+ vectors_base() == 0)
+ goto out;
+
+ down_write(¤t->mm->mmap_sem);
+ ret = do_mremap(addr, old_len, new_len, flags, new_addr);
+ up_write(¤t->mm->mmap_sem);
+
+out:
+ return ret;
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)