Commit 9ea57b72 authored by Al Viro's avatar Al Viro
Browse files

trailing_symlink: nd->depth massage, part 7



move decrement of nd->depth on successful returns into the callers.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0fd889d5
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -2009,10 +2009,8 @@ static int trailing_symlink(struct nameidata *nd)
	s = get_link(nd);
	s = get_link(nd);
	if (unlikely(IS_ERR(s)))
	if (unlikely(IS_ERR(s)))
		return PTR_ERR(s);
		return PTR_ERR(s);
	if (unlikely(!s)) {
	if (unlikely(!s))
		nd->depth--;
		return 0;
		return 0;
	}
	if (*s == '/') {
	if (*s == '/') {
		if (!nd->root.mnt)
		if (!nd->root.mnt)
			set_root(nd);
			set_root(nd);
@@ -2028,7 +2026,6 @@ static int trailing_symlink(struct nameidata *nd)
		put_link(nd);
		put_link(nd);
		return error;
		return error;
	}
	}
	nd->depth--;
	return 0;
	return 0;
}
}


@@ -2069,6 +2066,7 @@ static int path_lookupat(int dfd, const struct filename *name,
			if (err)
			if (err)
				break;
				break;
			err = lookup_last(nd);
			err = lookup_last(nd);
			nd->depth--;
			put_link(nd);
			put_link(nd);
		}
		}
	}
	}
@@ -2418,6 +2416,7 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
		if (err)
		if (err)
			break;
			break;
		err = mountpoint_last(nd, path);
		err = mountpoint_last(nd, path);
		nd->depth--;
		put_link(nd);
		put_link(nd);
	}
	}
out:
out:
@@ -3302,6 +3301,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
		if (unlikely(error))
		if (unlikely(error))
			break;
			break;
		error = do_last(nd, file, op, &opened, pathname);
		error = do_last(nd, file, op, &opened, pathname);
		nd->depth--;
		put_link(nd);
		put_link(nd);
	}
	}
out:
out: