From fc5bf0850388e3b6c2d44bc8bf321e218990389f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 9 Mar 2011 16:22:18 -0500 Subject: [PATCH] --- yaml --- r: 234267 b: refs/heads/master c: 40b39136f07279fdc868a36cba050f4e84ce0ace h: refs/heads/master i: 234265: 82911afefb0dcfcd5cbd56d1b006f8b50c448f57 234263: b49ac7f6b76df5f52b447eab8ada758ee120258d v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 4250efa8b3a7..6f1f5a92a906 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f374ed5fa8afed8590deaae5dc147422e0e1a6d9 +refs/heads/master: 40b39136f07279fdc868a36cba050f4e84ce0ace diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 6972e761286b..ca9a06a65704 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -2320,11 +2320,12 @@ static struct file *path_openat(int dfd, const char *pathname, struct path link = path; struct inode *linki = link.dentry->d_inode; void *cookie; - error = -ELOOP; - if (!(nd.flags & LOOKUP_FOLLOW)) - goto exit_dput; - if (count++ == 32) - goto exit_dput; + if (!(nd.flags & LOOKUP_FOLLOW) || count++ == 32) { + path_put_conditional(&path, &nd); + path_put(&nd.path); + filp = ERR_PTR(-ELOOP); + break; + } /* * This is subtle. Instead of calling do_follow_link() we do * the thing by hands. The reason is that this way we have zero @@ -2355,9 +2356,6 @@ static struct file *path_openat(int dfd, const char *pathname, release_open_intent(&nd); return filp; -exit_dput: - path_put_conditional(&path, &nd); - path_put(&nd.path); out_filp: filp = ERR_PTR(error); goto out;