goto dput_and_out;
error = -EROFS;
- if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
inode = nd.dentry->d_inode;
error = -EROFS;
- if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ if (IS_RDONLY(inode))
goto dput_and_out;
/* Don't worry, the checks are done in inode_change_ok() */
inode = nd.dentry->d_inode;
error = -EROFS;
- if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ if (IS_RDONLY(inode))
goto dput_and_out;
/* Don't worry, the checks are done in inode_change_ok() */
if (!res) {
res = permission(nd.dentry->d_inode, mode, &nd);
/* SuS v2 requires we report a read only fs too */
- if(!res && (mode & S_IWOTH)
- && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt))
+ if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
&& !special_file(nd.dentry->d_inode->i_mode))
res = -EROFS;
path_release(&nd);
dentry = file->f_dentry;
inode = dentry->d_inode;
+ err = -EPERM;
+ if (IS_BARRIER(inode) && !vx_check(0, VX_ADMIN))
+ goto out_putf;
err = -EROFS;
- if (IS_RDONLY(inode) || (file && MNT_IS_RDONLY(file->f_vfsmnt)))
+ if (IS_RDONLY(inode))
goto out_putf;
err = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
inode = nd.dentry->d_inode;
+ error = -EPERM;
+ if (IS_BARRIER(inode) && !vx_check(0, VX_ADMIN))
+ goto dput_and_out;
+
error = -EROFS;
- if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
return error;
}
-static int chown_common(struct dentry *dentry, struct vfsmount *mnt,
- uid_t user, gid_t group)
+static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
{
struct inode * inode;
int error;
goto out;
}
error = -EROFS;
- if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
+ if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
error = user_path_walk(filename, &nd);
if (!error) {
- error = chown_common(nd.dentry, nd.mnt, user, group);
+ error = chown_common(nd.dentry, user, group);
path_release(&nd);
}
return error;
error = user_path_walk_link(filename, &nd);
if (!error) {
- error = chown_common(nd.dentry, nd.mnt, user, group);
+ error = chown_common(nd.dentry, user, group);
path_release(&nd);
}
return error;
file = fget(fd);
if (file) {
- error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
+ error = chown_common(file->f_dentry, user, group);
fput(file);
}
return error;
if (!f)
goto cleanup_dentry;
f->f_flags = flags;
- f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
+ f->f_mode = (flags+1) & O_ACCMODE;
inode = dentry->d_inode;
if (f->f_mode & FMODE_WRITE) {
error = get_write_access(inode);
FD_SET(fd, files->open_fds);
FD_CLR(fd, files->close_on_exec);
files->next_fd = fd + 1;
- // vx_openfd_inc(fd);
+ vx_openfd_inc(fd);
#if 1
/* Sanity check */
if (files->fd[fd] != NULL) {
__FD_CLR(fd, files->open_fds);
if (fd < files->next_fd)
files->next_fd = fd;
- // vx_openfd_dec(fd);
+ vx_openfd_dec(fd);
}
void fastcall put_unused_fd(unsigned int fd)
}
EXPORT_SYMBOL(generic_file_open);
-
-/*
- * This is used by subsystems that don't want seekable
- * file descriptors
- */
-int nonseekable_open(struct inode *inode, struct file *filp)
-{
- filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
- return 0;
-}
-
-EXPORT_SYMBOL(nonseekable_open);