summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 678aeef85490..c5eb77a57974 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1865,11 +1865,13 @@ OK:
 						;
 				}
 				nd->inode = nd->path.dentry->d_inode;
-				nd->stack[nd->depth - 1].name = name;
-				if (!*s)
-					goto OK;
-				name = s;
-				continue;
+				if (unlikely(!*s)) {
+					put_link(nd);
+				} else {
+					nd->stack[nd->depth - 1].name = name;
+					name = s;
+					continue;
+				}
 			}
 		}
 		if (!d_can_lookup(nd->path.dentry)) {