From 13ad09f9cf5ccbee22a72fe08af6d4be3083f0bf Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 22 Feb 2011 21:24:38 -0500 Subject: [PATCH] --- yaml --- r: 234247 b: refs/heads/master c: 36f3b4f69070fee7c647bab5dc4408990bb3606c h: refs/heads/master i: 234245: 0c780453511e09ba8d0ea6d0528a40dc010cfdd1 234243: b1b4663a3d8ce6ba7f313f066b982032ec68c509 234239: c36f953c61472c01e8877eb1b9a0847441a90f60 v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index f6fd4be9f5d2..648ed691ea91 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 086e183a641109033420e0b26ddecb6f4abb4c89 +refs/heads/master: 36f3b4f69070fee7c647bab5dc4408990bb3606c diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 8f10a9ff9f6b..f956567270bb 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -754,6 +754,13 @@ __do_follow_link(const struct path *link, struct nameidata *nd, void **p) if (link->mnt == nd->path.mnt) mntget(link->mnt); + error = security_inode_follow_link(link->dentry, nd); + if (error) { + *p = ERR_PTR(error); /* no ->put_link(), please */ + path_put(&nd->path); + return error; + } + nd->last_type = LAST_BIND; *p = dentry->d_inode->i_op->follow_link(dentry, nd); error = PTR_ERR(*p); @@ -791,9 +798,6 @@ static inline int do_follow_link(struct inode *inode, struct path *path, struct goto loop; BUG_ON(nd->depth >= MAX_NESTED_LINKS); cond_resched(); - err = security_inode_follow_link(path->dentry, nd); - if (err) - goto loop; current->link_count++; current->total_link_count++; nd->depth++; @@ -2420,9 +2424,6 @@ struct file *do_filp_open(int dfd, const char *pathname, * just set LAST_BIND. */ nd.flags |= LOOKUP_PARENT; - error = security_inode_follow_link(link.dentry, &nd); - if (error) - goto exit_dput; error = __do_follow_link(&link, &nd, &cookie); if (unlikely(error)) { if (!IS_ERR(cookie) && linki->i_op->put_link)