diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-30 16:13:38 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-23 05:31:36 +0100 |
commit | 740da42efa24ac00dfb40d2f02d9d7f7a485049b (patch) | |
tree | ae71dfa023025a8247c4615439383fbbdbf4720c /fs/dcache.c | |
parent | fs: Fix possible use-after-free with AIO (diff) | |
download | linux-740da42efa24ac00dfb40d2f02d9d7f7a485049b.tar.xz linux-740da42efa24ac00dfb40d2f02d9d7f7a485049b.zip |
__d_materialise_unique() is too generic
Its first argument is always non-root, while the second one is
always root.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 0e4b5fa6c9f9..ada6123414ae 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2394,7 +2394,7 @@ out_err: */ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) { - struct dentry *dparent, *aparent; + struct dentry *dparent; dentry_lock_for_move(anon, dentry); @@ -2402,24 +2402,15 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) write_seqcount_begin(&anon->d_seq); dparent = dentry->d_parent; - aparent = anon->d_parent; switch_names(dentry, anon); swap(dentry->d_name.hash, anon->d_name.hash); - dentry->d_parent = (aparent == anon) ? dentry : aparent; - list_del(&dentry->d_u.d_child); - if (!IS_ROOT(dentry)) - list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); - else - INIT_LIST_HEAD(&dentry->d_u.d_child); - - anon->d_parent = (dparent == dentry) ? anon : dparent; + dentry->d_parent = dentry; + list_del_init(&dentry->d_u.d_child); + anon->d_parent = dparent; list_del(&anon->d_u.d_child); - if (!IS_ROOT(anon)) - list_add(&anon->d_u.d_child, &anon->d_parent->d_subdirs); - else - INIT_LIST_HEAD(&anon->d_u.d_child); + list_add(&anon->d_u.d_child, &dparent->d_subdirs); write_seqcount_end(&dentry->d_seq); write_seqcount_end(&anon->d_seq); |