diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-02-22 21:24:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-14 09:15:24 -0400 |
commit | 36f3b4f69070fee7c647bab5dc4408990bb3606c (patch) | |
tree | 47431f3ae87bd5c81a157287d2d433386e9bbf6f /fs/namei.c | |
parent | 086e183a641109033420e0b26ddecb6f4abb4c89 (diff) |
pull security_inode_follow_link() into __do_follow_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 8f10a9ff9f6b..f956567270bb 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -754,6 +754,13 @@ __do_follow_link(const struct path *link, struct nameidata *nd, void **p) | |||
754 | if (link->mnt == nd->path.mnt) | 754 | if (link->mnt == nd->path.mnt) |
755 | mntget(link->mnt); | 755 | mntget(link->mnt); |
756 | 756 | ||
757 | error = security_inode_follow_link(link->dentry, nd); | ||
758 | if (error) { | ||
759 | *p = ERR_PTR(error); /* no ->put_link(), please */ | ||
760 | path_put(&nd->path); | ||
761 | return error; | ||
762 | } | ||
763 | |||
757 | nd->last_type = LAST_BIND; | 764 | nd->last_type = LAST_BIND; |
758 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); | 765 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); |
759 | error = PTR_ERR(*p); | 766 | error = PTR_ERR(*p); |
@@ -791,9 +798,6 @@ static inline int do_follow_link(struct inode *inode, struct path *path, struct | |||
791 | goto loop; | 798 | goto loop; |
792 | BUG_ON(nd->depth >= MAX_NESTED_LINKS); | 799 | BUG_ON(nd->depth >= MAX_NESTED_LINKS); |
793 | cond_resched(); | 800 | cond_resched(); |
794 | err = security_inode_follow_link(path->dentry, nd); | ||
795 | if (err) | ||
796 | goto loop; | ||
797 | current->link_count++; | 801 | current->link_count++; |
798 | current->total_link_count++; | 802 | current->total_link_count++; |
799 | nd->depth++; | 803 | nd->depth++; |
@@ -2420,9 +2424,6 @@ reval: | |||
2420 | * just set LAST_BIND. | 2424 | * just set LAST_BIND. |
2421 | */ | 2425 | */ |
2422 | nd.flags |= LOOKUP_PARENT; | 2426 | nd.flags |= LOOKUP_PARENT; |
2423 | error = security_inode_follow_link(link.dentry, &nd); | ||
2424 | if (error) | ||
2425 | goto exit_dput; | ||
2426 | error = __do_follow_link(&link, &nd, &cookie); | 2427 | error = __do_follow_link(&link, &nd, &cookie); |
2427 | if (unlikely(error)) { | 2428 | if (unlikely(error)) { |
2428 | if (!IS_ERR(cookie) && linki->i_op->put_link) | 2429 | if (!IS_ERR(cookie) && linki->i_op->put_link) |