VFS: Properly free dentry name snapshots in vfs_rename2

An error in commit 0a420e78c31b ("BACKPORT: dentry name snapshots")
errantly replaced the fsnotify_oldname_free() with a
take_dentry_name_snapshot() instead of the intended
release_dentry_name_snapshot() as demonstrated in the upstream
commit. This results in taking another snapshot and leaking of the
memory allocated for the snapshot name.

Change-Id: I13356a0cc12fbaf63330d6781ad65ed735e6bc0d
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
Fixes: 0a420e78c31b ("BACKPORT: dentry name snapshots")
This commit is contained in:
Kevin F. Haggerty 2018-02-23 16:03:24 -07:00 committed by syphyr
parent 680001a578
commit 63cbbceed4

View file

@ -3994,7 +3994,7 @@ int vfs_rename2(struct vfsmount *mnt,
if (!error)
fsnotify_move(old_dir, new_dir, old_name.name, is_dir,
new_dentry->d_inode, old_dentry);
take_dentry_name_snapshot(&old_name, old_dentry);
release_dentry_name_snapshot(&old_name);
return error;
}