mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Merge tag 'v6.5/vfs.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: "This contains two minor fixes for Jan's rename locking work: - Unlocking the source inode was guarded by a check whether source was non-NULL. This doesn't make sense because source must be non-NULL and the commit message explains in detail why - The lock_two_nondirectories() helper called WARN_ON_ONCE() and dereferenced the inodes unconditionally but the underlying lock_two_inodes() helper and the kernel documentation for that function are clear that it is valid to pass NULL arguments, so a non-NULL check is needed. No callers currently pass NULL arguments but let's not knowingly leave landmines around" * tag 'v6.5/vfs.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: fs: don't assume arguments are non-NULL fs: no need to check source
This commit is contained in:
@@ -1156,8 +1156,10 @@ lock:
|
|||||||
*/
|
*/
|
||||||
void lock_two_nondirectories(struct inode *inode1, struct inode *inode2)
|
void lock_two_nondirectories(struct inode *inode1, struct inode *inode2)
|
||||||
{
|
{
|
||||||
WARN_ON_ONCE(S_ISDIR(inode1->i_mode));
|
if (inode1)
|
||||||
WARN_ON_ONCE(S_ISDIR(inode2->i_mode));
|
WARN_ON_ONCE(S_ISDIR(inode1->i_mode));
|
||||||
|
if (inode2)
|
||||||
|
WARN_ON_ONCE(S_ISDIR(inode2->i_mode));
|
||||||
lock_two_inodes(inode1, inode2, I_MUTEX_NORMAL, I_MUTEX_NONDIR2);
|
lock_two_inodes(inode1, inode2, I_MUTEX_NORMAL, I_MUTEX_NONDIR2);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(lock_two_nondirectories);
|
EXPORT_SYMBOL(lock_two_nondirectories);
|
||||||
|
@@ -4874,8 +4874,7 @@ int vfs_rename(struct renamedata *rd)
|
|||||||
d_exchange(old_dentry, new_dentry);
|
d_exchange(old_dentry, new_dentry);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (source)
|
inode_unlock(source);
|
||||||
inode_unlock(source);
|
|
||||||
if (target)
|
if (target)
|
||||||
inode_unlock(target);
|
inode_unlock(target);
|
||||||
dput(new_dentry);
|
dput(new_dentry);
|
||||||
|
Reference in New Issue
Block a user