[PATCH] VM: add capabilites check to set_zone_reclaim
authorMartin Hicks <mort@sgi.com>
Sat, 3 Sep 2005 22:54:50 +0000 (15:54 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Mon, 5 Sep 2005 07:05:44 +0000 (00:05 -0700)
Add a capability check to sys_set_zone_reclaim().  This syscall is not
something that should be available to a user.

Signed-off-by: Martin Hicks <mort@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/capability.h
mm/vmscan.c

index 8d139f4acf23beb9f7d92274f4b96f14d3f09f37..6b4618902d3dd3f9fcb6298326a757dac415fb87 100644 (file)
@@ -233,6 +233,7 @@ typedef __u32 kernel_cap_t;
 /* Allow enabling/disabling tagged queuing on SCSI controllers and sending
    arbitrary SCSI commands */
 /* Allow setting encryption key on loopback filesystem */
+/* Allow setting zone reclaim policy */
 
 #define CAP_SYS_ADMIN        21
 
index cfffe5098d538e6d54d1954c523d455924cbf7fc..ab631a3c62c3c1ffefa41cc510b5889e5ceb21ca 100644 (file)
@@ -1375,6 +1375,9 @@ asmlinkage long sys_set_zone_reclaim(unsigned int node, unsigned int zone,
        struct zone *z;
        int i;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EACCES;
+
        if (node >= MAX_NUMNODES || !node_online(node))
                return -EINVAL;