From 7de3a7b25f649e11cc4725b9d5ef84158a97f9e6 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 18 Jan 2004 18:39:14 -0800 Subject: [PATCH] [PATCH] nfs: Fix an open intent bug From: Trond Myklebust The following patch fixes a bug when initializing the intent structure in sys_uselib(): intents use the FMODE_READ convention rather than O_RDONLY. It also adds a missing open intent to open_exec(). This ensures that NFS clients will do the necessary close-to-open data cache consistency checking. --- fs/exec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index a0e769adec78c..73c5213a62931 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -121,7 +121,7 @@ asmlinkage long sys_uselib(const char __user * library) struct nameidata nd; int error; - nd.intent.open.flags = O_RDONLY; + nd.intent.open.flags = FMODE_READ; error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd); if (error) goto out; @@ -471,8 +471,12 @@ static inline void free_arg_pages(struct linux_binprm *bprm) struct file *open_exec(const char *name) { struct nameidata nd; - int err = path_lookup(name, LOOKUP_FOLLOW, &nd); - struct file *file = ERR_PTR(err); + int err; + struct file *file; + + nd.intent.open.flags = FMODE_READ; + err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd); + file = ERR_PTR(err); if (!err) { struct inode *inode = nd.dentry->d_inode; -- 2.53.0