kernel - Fix access chceck in tmpfs that prevented chroot's into it
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 1 Nov 2010 16:29:31 +0000 (09:29 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 1 Nov 2010 16:30:57 +0000 (09:30 -0700)
* Fix broken code which caused access() calls into tmpfs to assume
  write permission was being requested when it was not.

Submitted-by: Rumko <rumcic@gmail.com>
sys/vfs/tmpfs/tmpfs_vnops.c

index fccc6b8..11a9614 100644 (file)
@@ -260,7 +260,7 @@ tmpfs_access(struct vop_access_args *v)
        case VLNK:
                /* FALLTHROUGH */
        case VREG:
-               if (VWRITE && vp->v_mount->mnt_flag & MNT_RDONLY) {
+               if ((v->a_mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) {
                        error = EROFS;
                        goto out;
                }
@@ -280,7 +280,7 @@ tmpfs_access(struct vop_access_args *v)
                goto out;
        }
 
-       if (VWRITE && node->tn_flags & IMMUTABLE) {
+       if ((v->a_mode & VWRITE) && (node->tn_flags & IMMUTABLE)) {
                error = EPERM;
                goto out;
        }