enable floppy module generation for boot cd
[linux-2.6.git] / fs / ext2 / acl.c
index 091a317..d232026 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
+#include <linux/namei.h> 
+#include <linux/vs_base.h>
 #include "ext2.h"
 #include "xattr.h"
 #include "acl.h"
@@ -161,7 +163,7 @@ ext2_get_acl(struct inode *inode, int type)
        int retval;
 
        if (!test_opt(inode->i_sb, POSIX_ACL))
-               return 0;
+               return NULL;
 
        switch(type) {
                case ACL_TYPE_ACCESS:
@@ -290,8 +292,12 @@ ext2_permission(struct inode *inode, int mask, struct nameidata *nd)
 {
        int mode = inode->i_mode;
 
+       /* Prevent vservers from escaping chroot() barriers */
+       if (IS_BARRIER(inode) && !vx_check(0, VX_ADMIN))
+               return -EACCES;
        /* Nobody gets write access to a read-only fs */
-       if ((mask & MAY_WRITE) && IS_RDONLY(inode) &&
+       if ((mask & MAY_WRITE) && (IS_RDONLY(inode) ||
+           (nd && MNT_IS_RDONLY(nd->mnt))) &&
            (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
                return -EROFS;
        /* Nobody gets write access to an immutable file */