git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
USB: keyspan: fix null-deref at disconnect and release
[pandora-kernel.git]
/
fs
/
namei.c
diff --git
a/fs/namei.c
b/fs/namei.c
index
ac6d214
..
9680cef
100644
(file)
--- a/
fs/namei.c
+++ b/
fs/namei.c
@@
-852,7
+852,7
@@
static int follow_managed(struct path *path, unsigned flags)
mntput(path->mnt);
if (ret == -EISDIR)
ret = 0;
mntput(path->mnt);
if (ret == -EISDIR)
ret = 0;
- return ret;
+ return ret
< 0 ? ret : need_mntput
;
}
int follow_down_one(struct path *path)
}
int follow_down_one(struct path *path)
@@
-900,6
+900,7
@@
static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
break;
path->mnt = mounted;
path->dentry = mounted->mnt_root;
break;
path->mnt = mounted;
path->dentry = mounted->mnt_root;
+ nd->flags |= LOOKUP_JUMPED;
nd->seq = read_seqcount_begin(&path->dentry->d_seq);
/*
* Update the inode too. We don't need to re-check the
nd->seq = read_seqcount_begin(&path->dentry->d_seq);
/*
* Update the inode too. We don't need to re-check the
@@
-1093,8
+1094,10
@@
static struct dentry *d_inode_lookup(struct dentry *parent, struct dentry *dentr
struct dentry *old;
/* Don't create child dentry for a dead directory. */
struct dentry *old;
/* Don't create child dentry for a dead directory. */
- if (unlikely(IS_DEADDIR(inode)))
+ if (unlikely(IS_DEADDIR(inode))) {
+ dput(dentry);
return ERR_PTR(-ENOENT);
return ERR_PTR(-ENOENT);
+ }
old = inode->i_op->lookup(inode, dentry, nd);
if (unlikely(old)) {
old = inode->i_op->lookup(inode, dentry, nd);
if (unlikely(old)) {
@@
-1213,6
+1216,8
@@
retry:
path_put_conditional(path, nd);
return err;
}
path_put_conditional(path, nd);
return err;
}
+ if (err)
+ nd->flags |= LOOKUP_JUMPED;
*inode = path->dentry->d_inode;
return 0;
}
*inode = path->dentry->d_inode;
return 0;
}
@@
-2134,7
+2139,7
@@
static struct file *do_last(struct nameidata *nd, struct path *path,
/* sayonara */
error = complete_walk(nd);
if (error)
/* sayonara */
error = complete_walk(nd);
if (error)
- return ERR_PTR(
-ECHILD
);
+ return ERR_PTR(
error
);
error = -ENOTDIR;
if (nd->flags & LOOKUP_DIRECTORY) {
error = -ENOTDIR;
if (nd->flags & LOOKUP_DIRECTORY) {
@@
-2146,6
+2151,10
@@
static struct file *do_last(struct nameidata *nd, struct path *path,
}
/* create side of things */
}
/* create side of things */
+ /*
+ * This will *only* deal with leaving RCU mode - LOOKUP_JUMPED has been
+ * cleared when we got to the last component we are about to look up
+ */
error = complete_walk(nd);
if (error)
return ERR_PTR(error);
error = complete_walk(nd);
if (error)
return ERR_PTR(error);
@@
-2214,6
+2223,9
@@
static struct file *do_last(struct nameidata *nd, struct path *path,
if (error < 0)
goto exit_dput;
if (error < 0)
goto exit_dput;
+ if (error)
+ nd->flags |= LOOKUP_JUMPED;
+
error = -ENOENT;
if (!path->dentry->d_inode)
goto exit_dput;
error = -ENOENT;
if (!path->dentry->d_inode)
goto exit_dput;
@@
-2223,6
+2235,10
@@
static struct file *do_last(struct nameidata *nd, struct path *path,
path_to_nameidata(path, nd);
nd->inode = path->dentry->d_inode;
path_to_nameidata(path, nd);
nd->inode = path->dentry->d_inode;
+ /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
+ error = complete_walk(nd);
+ if (error)
+ return ERR_PTR(error);
error = -EISDIR;
if (S_ISDIR(nd->inode->i_mode))
goto exit;
error = -EISDIR;
if (S_ISDIR(nd->inode->i_mode))
goto exit;