Commit 7de3a7b2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] nfs: Fix an open intent bug

From: Trond Myklebust <trond.myklebust@fys.uio.no>

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.
parent ac48c0dd
...@@ -121,7 +121,7 @@ asmlinkage long sys_uselib(const char __user * library) ...@@ -121,7 +121,7 @@ asmlinkage long sys_uselib(const char __user * library)
struct nameidata nd; struct nameidata nd;
int error; int error;
nd.intent.open.flags = O_RDONLY; nd.intent.open.flags = FMODE_READ;
error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd); error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
if (error) if (error)
goto out; goto out;
...@@ -471,8 +471,12 @@ static inline void free_arg_pages(struct linux_binprm *bprm) ...@@ -471,8 +471,12 @@ static inline void free_arg_pages(struct linux_binprm *bprm)
struct file *open_exec(const char *name) struct file *open_exec(const char *name)
{ {
struct nameidata nd; struct nameidata nd;
int err = path_lookup(name, LOOKUP_FOLLOW, &nd); int err;
struct file *file = ERR_PTR(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) { if (!err) {
struct inode *inode = nd.dentry->d_inode; struct inode *inode = nd.dentry->d_inode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment