@@ -1153,7 +1153,9 @@ const char *get_link(struct nameidata *nd)
} else {
res = get(dentry, inode, &last->done);
}
- if (IS_ERR_OR_NULL(res))
+ if (!res)
+ goto all_done;
+ if (IS_ERR(res))
return res;
}
if (*res == '/') {
@@ -1163,9 +1165,11 @@ const char *get_link(struct nameidata *nd)
while (unlikely(*++res == '/'))
;
}
- if (!*res)
- res = NULL;
- return res;
+ if (*res)
+ return res;
+all_done: // pure jump
+ put_link(nd);
+ return NULL;
}
/*
@@ -2210,11 +2214,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (IS_ERR(s))
return PTR_ERR(s);
- err = 0;
- if (unlikely(!s)) {
- /* jumped */
- put_link(nd);
- } else {
+ if (likely(s)) {
nd->stack[nd->depth - 1].name = name;
name = s;
continue;