aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 0087cf9c2c6b..a4689eb2df28 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1546,6 +1546,7 @@ static int path_walk(const char *name, struct nameidata *nd)
1546 /* nd->path had been dropped */ 1546 /* nd->path had been dropped */
1547 current->total_link_count = 0; 1547 current->total_link_count = 0;
1548 nd->path = save; 1548 nd->path = save;
1549 nd->inode = save.dentry->d_inode;
1549 path_get(&nd->path); 1550 path_get(&nd->path);
1550 nd->flags |= LOOKUP_REVAL; 1551 nd->flags |= LOOKUP_REVAL;
1551 result = link_path_walk(name, nd); 1552 result = link_path_walk(name, nd);
@@ -2455,22 +2456,29 @@ struct file *do_filp_open(int dfd, const char *pathname,
2455 /* !O_CREAT, simple open */ 2456 /* !O_CREAT, simple open */
2456 error = do_path_lookup(dfd, pathname, flags, &nd); 2457 error = do_path_lookup(dfd, pathname, flags, &nd);
2457 if (unlikely(error)) 2458 if (unlikely(error))
2458 goto out_filp; 2459 goto out_filp2;
2459 error = -ELOOP; 2460 error = -ELOOP;
2460 if (!(nd.flags & LOOKUP_FOLLOW)) { 2461 if (!(nd.flags & LOOKUP_FOLLOW)) {
2461 if (nd.inode->i_op->follow_link) 2462 if (nd.inode->i_op->follow_link)
2462 goto out_path; 2463 goto out_path2;
2463 } 2464 }
2464 error = -ENOTDIR; 2465 error = -ENOTDIR;
2465 if (nd.flags & LOOKUP_DIRECTORY) { 2466 if (nd.flags & LOOKUP_DIRECTORY) {
2466 if (!nd.inode->i_op->lookup) 2467 if (!nd.inode->i_op->lookup)
2467 goto out_path; 2468 goto out_path2;
2468 } 2469 }
2469 audit_inode(pathname, nd.path.dentry); 2470 audit_inode(pathname, nd.path.dentry);
2470 filp = finish_open(&nd, open_flag, acc_mode); 2471 filp = finish_open(&nd, open_flag, acc_mode);
2472out2:
2471 release_open_intent(&nd); 2473 release_open_intent(&nd);
2472 return filp; 2474 return filp;
2473 2475
2476out_path2:
2477 path_put(&nd.path);
2478out_filp2:
2479 filp = ERR_PTR(error);
2480 goto out2;
2481
2474creat: 2482creat:
2475 /* OK, have to create the file. Find the parent. */ 2483 /* OK, have to create the file. Find the parent. */
2476 error = path_init_rcu(dfd, pathname, 2484 error = path_init_rcu(dfd, pathname,