Loading arch/um/drivers/mconsole_kern.c +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ void mconsole_proc(struct mc_request *req) goto out; } err = may_open(&nd.path, MAY_READ, FMODE_READ); err = may_open(&nd.path, MAY_READ, O_RDONLY); if (result) { mconsole_reply(req, "Failed to open file", 1, 0); path_put(&nd.path); Loading fs/cifs/file.c +2 −2 Original line number Diff line number Diff line Loading @@ -2289,9 +2289,9 @@ cifs_oplock_break(struct slow_work *work) if (inode && S_ISREG(inode->i_mode)) { #ifdef CONFIG_CIFS_EXPERIMENTAL if (cinode->clientCanCacheAll == 0) break_lease(inode, FMODE_READ); break_lease(inode, O_RDONLY); else if (cinode->clientCanCacheRead == 0) break_lease(inode, FMODE_WRITE); break_lease(inode, O_WRONLY); #endif rc = filemap_fdatawrite(inode->i_mapping); if (cinode->clientCanCacheRead == 0) { Loading fs/locks.c +3 −2 Original line number Diff line number Diff line Loading @@ -1182,8 +1182,9 @@ int __break_lease(struct inode *inode, unsigned int mode) struct file_lock *fl; unsigned long break_time; int i_have_this_lease = 0; int want_write = (mode & O_ACCMODE) != O_RDONLY; new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK); new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK); lock_kernel(); Loading @@ -1197,7 +1198,7 @@ int __break_lease(struct inode *inode, unsigned int mode) if (fl->fl_owner == current->files) i_have_this_lease = 1; if (mode & FMODE_WRITE) { if (want_write) { /* If we want write access, we have to revoke any lease. */ future = F_UNLCK | F_INPROGRESS; } else if (flock->fl_type & F_INPROGRESS) { Loading fs/namei.c +5 −5 Original line number Diff line number Diff line Loading @@ -1503,7 +1503,7 @@ int may_open(struct path *path, int acc_mode, int flag) * An append-only file must be opened in append mode for writing. */ if (IS_APPEND(inode)) { if ((flag & FMODE_WRITE) && !(flag & O_APPEND)) if ((flag & O_ACCMODE) != O_RDONLY && !(flag & O_APPEND)) return -EPERM; if (flag & O_TRUNC) return -EPERM; Loading Loading @@ -1547,7 +1547,7 @@ static int handle_truncate(struct path *path) * what get passed to sys_open(). */ static int __open_namei_create(struct nameidata *nd, struct path *path, int flag, int mode) int open_flag, int mode) { int error; struct dentry *dir = nd->path.dentry; Loading @@ -1565,7 +1565,7 @@ static int __open_namei_create(struct nameidata *nd, struct path *path, if (error) return error; /* Don't check for write permission, don't truncate */ return may_open(&nd->path, 0, flag & ~O_TRUNC); return may_open(&nd->path, 0, open_flag & ~O_TRUNC); } /* Loading Loading @@ -1736,7 +1736,7 @@ struct file *do_filp_open(int dfd, const char *pathname, error = mnt_want_write(nd.path.mnt); if (error) goto exit_mutex_unlock; error = __open_namei_create(&nd, &path, flag, mode); error = __open_namei_create(&nd, &path, open_flag, mode); if (error) { mnt_drop_write(nd.path.mnt); goto exit; Loading Loading @@ -1798,7 +1798,7 @@ struct file *do_filp_open(int dfd, const char *pathname, if (error) goto exit; } error = may_open(&nd.path, acc_mode, flag); error = may_open(&nd.path, acc_mode, open_flag); if (error) { if (will_truncate) mnt_drop_write(nd.path.mnt); Loading fs/nfsctl.c +2 −3 Original line number Diff line number Diff line Loading @@ -36,10 +36,9 @@ static struct file *do_open(char *name, int flags) return ERR_PTR(error); if (flags == O_RDWR) error = may_open(&nd.path, MAY_READ|MAY_WRITE, FMODE_READ|FMODE_WRITE); error = may_open(&nd.path, MAY_READ|MAY_WRITE, flags); else error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE); error = may_open(&nd.path, MAY_WRITE, flags); if (!error) return dentry_open(nd.path.dentry, nd.path.mnt, flags, Loading Loading
arch/um/drivers/mconsole_kern.c +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ void mconsole_proc(struct mc_request *req) goto out; } err = may_open(&nd.path, MAY_READ, FMODE_READ); err = may_open(&nd.path, MAY_READ, O_RDONLY); if (result) { mconsole_reply(req, "Failed to open file", 1, 0); path_put(&nd.path); Loading
fs/cifs/file.c +2 −2 Original line number Diff line number Diff line Loading @@ -2289,9 +2289,9 @@ cifs_oplock_break(struct slow_work *work) if (inode && S_ISREG(inode->i_mode)) { #ifdef CONFIG_CIFS_EXPERIMENTAL if (cinode->clientCanCacheAll == 0) break_lease(inode, FMODE_READ); break_lease(inode, O_RDONLY); else if (cinode->clientCanCacheRead == 0) break_lease(inode, FMODE_WRITE); break_lease(inode, O_WRONLY); #endif rc = filemap_fdatawrite(inode->i_mapping); if (cinode->clientCanCacheRead == 0) { Loading
fs/locks.c +3 −2 Original line number Diff line number Diff line Loading @@ -1182,8 +1182,9 @@ int __break_lease(struct inode *inode, unsigned int mode) struct file_lock *fl; unsigned long break_time; int i_have_this_lease = 0; int want_write = (mode & O_ACCMODE) != O_RDONLY; new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK); new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK); lock_kernel(); Loading @@ -1197,7 +1198,7 @@ int __break_lease(struct inode *inode, unsigned int mode) if (fl->fl_owner == current->files) i_have_this_lease = 1; if (mode & FMODE_WRITE) { if (want_write) { /* If we want write access, we have to revoke any lease. */ future = F_UNLCK | F_INPROGRESS; } else if (flock->fl_type & F_INPROGRESS) { Loading
fs/namei.c +5 −5 Original line number Diff line number Diff line Loading @@ -1503,7 +1503,7 @@ int may_open(struct path *path, int acc_mode, int flag) * An append-only file must be opened in append mode for writing. */ if (IS_APPEND(inode)) { if ((flag & FMODE_WRITE) && !(flag & O_APPEND)) if ((flag & O_ACCMODE) != O_RDONLY && !(flag & O_APPEND)) return -EPERM; if (flag & O_TRUNC) return -EPERM; Loading Loading @@ -1547,7 +1547,7 @@ static int handle_truncate(struct path *path) * what get passed to sys_open(). */ static int __open_namei_create(struct nameidata *nd, struct path *path, int flag, int mode) int open_flag, int mode) { int error; struct dentry *dir = nd->path.dentry; Loading @@ -1565,7 +1565,7 @@ static int __open_namei_create(struct nameidata *nd, struct path *path, if (error) return error; /* Don't check for write permission, don't truncate */ return may_open(&nd->path, 0, flag & ~O_TRUNC); return may_open(&nd->path, 0, open_flag & ~O_TRUNC); } /* Loading Loading @@ -1736,7 +1736,7 @@ struct file *do_filp_open(int dfd, const char *pathname, error = mnt_want_write(nd.path.mnt); if (error) goto exit_mutex_unlock; error = __open_namei_create(&nd, &path, flag, mode); error = __open_namei_create(&nd, &path, open_flag, mode); if (error) { mnt_drop_write(nd.path.mnt); goto exit; Loading Loading @@ -1798,7 +1798,7 @@ struct file *do_filp_open(int dfd, const char *pathname, if (error) goto exit; } error = may_open(&nd.path, acc_mode, flag); error = may_open(&nd.path, acc_mode, open_flag); if (error) { if (will_truncate) mnt_drop_write(nd.path.mnt); Loading
fs/nfsctl.c +2 −3 Original line number Diff line number Diff line Loading @@ -36,10 +36,9 @@ static struct file *do_open(char *name, int flags) return ERR_PTR(error); if (flags == O_RDWR) error = may_open(&nd.path, MAY_READ|MAY_WRITE, FMODE_READ|FMODE_WRITE); error = may_open(&nd.path, MAY_READ|MAY_WRITE, flags); else error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE); error = may_open(&nd.path, MAY_WRITE, flags); if (!error) return dentry_open(nd.path.dentry, nd.path.mnt, flags, Loading