From: NeilBrown vfs_lookup_open() must allow: O_LARGEFILE so that large files can be opened. O_NONBLOCK so that break_lease() can be asked to return -EWOULDBLOCK. Also allow O_NOFOLLOW as we don't/can't handle symlinks. In fact we should enforce O_NOFOLLOW for the same reason we enforce __O_REGULAR. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/namei.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index f2c7a69f4fdd..d46f157e0cfc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4750,11 +4750,12 @@ struct file *vfs_lookup_open(struct path *parent, struct qstr *last, int error = 0; WARN_ONCE(mode & ~S_IALLUGO, "mode must only have permission bits"); - WARN_ONCE(open_flag & ~(O_ACCMODE|O_CREAT|O_EXCL|O_TRUNC|__O_REGULAR), + WARN_ONCE(open_flag & ~(O_ACCMODE|O_CREAT|O_EXCL|O_TRUNC|__O_REGULAR| + O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW), "open_flag has unsupported flags"); mode |= S_IFREG; - open_flag |= __O_REGULAR; + open_flag |= __O_REGULAR | O_NOFOLLOW; error = lookup_noperm_common(last, parent->dentry); if (error) -- 2.50.0.107.gf914562f5916.dirty