diff options
| -rw-r--r-- | fs/namei.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c index 0087cf9c2c6b..a5e844fe4b28 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -2455,22 +2455,29 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
| 2455 | /* !O_CREAT, simple open */ | 2455 | /* !O_CREAT, simple open */ |
| 2456 | error = do_path_lookup(dfd, pathname, flags, &nd); | 2456 | error = do_path_lookup(dfd, pathname, flags, &nd); |
| 2457 | if (unlikely(error)) | 2457 | if (unlikely(error)) |
| 2458 | goto out_filp; | 2458 | goto out_filp2; |
| 2459 | error = -ELOOP; | 2459 | error = -ELOOP; |
| 2460 | if (!(nd.flags & LOOKUP_FOLLOW)) { | 2460 | if (!(nd.flags & LOOKUP_FOLLOW)) { |
| 2461 | if (nd.inode->i_op->follow_link) | 2461 | if (nd.inode->i_op->follow_link) |
| 2462 | goto out_path; | 2462 | goto out_path2; |
| 2463 | } | 2463 | } |
| 2464 | error = -ENOTDIR; | 2464 | error = -ENOTDIR; |
| 2465 | if (nd.flags & LOOKUP_DIRECTORY) { | 2465 | if (nd.flags & LOOKUP_DIRECTORY) { |
| 2466 | if (!nd.inode->i_op->lookup) | 2466 | if (!nd.inode->i_op->lookup) |
| 2467 | goto out_path; | 2467 | goto out_path2; |
| 2468 | } | 2468 | } |
| 2469 | audit_inode(pathname, nd.path.dentry); | 2469 | audit_inode(pathname, nd.path.dentry); |
| 2470 | filp = finish_open(&nd, open_flag, acc_mode); | 2470 | filp = finish_open(&nd, open_flag, acc_mode); |
| 2471 | out2: | ||
| 2471 | release_open_intent(&nd); | 2472 | release_open_intent(&nd); |
| 2472 | return filp; | 2473 | return filp; |
| 2473 | 2474 | ||
| 2475 | out_path2: | ||
| 2476 | path_put(&nd.path); | ||
| 2477 | out_filp2: | ||
| 2478 | filp = ERR_PTR(error); | ||
| 2479 | goto out2; | ||
| 2480 | |||
| 2474 | creat: | 2481 | creat: |
| 2475 | /* OK, have to create the file. Find the parent. */ | 2482 | /* OK, have to create the file. Find the parent. */ |
| 2476 | error = path_init_rcu(dfd, pathname, | 2483 | error = path_init_rcu(dfd, pathname, |
