Skip to content

Commit

Permalink
Fix mountpoint reference leakage in linkat
Browse files Browse the repository at this point in the history
Recent changes to retry on ESTALE in linkat
(commit 442e31c)
introduced a mountpoint reference leak and a small memory
leak in case a filesystem link operation returns ESTALE
which is pretty normal for distributed filesystems like
lustre, nfs and so on.
Free old_path in such a case.

[AV: there was another missing path_put() nearby - on the previous
goto retry]

Signed-off-by: Oleg Drokin: <green@linuxhacker.ru>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Oleg Drokin authored and Al Viro committed Jan 31, 2014
1 parent b168fff commit d22e633
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -3926,10 +3926,13 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
done_path_create(&new_path, new_dentry);
if (delegated_inode) {
error = break_deleg_wait(&delegated_inode);
if (!error)
if (!error) {
path_put(&old_path);
goto retry;
}
}
if (retry_estale(error, how)) {
path_put(&old_path);
how |= LOOKUP_REVAL;
goto retry;
}
Expand Down

0 comments on commit d22e633

Please sign in to comment.