Skip to contentSkip to conversation

NFS: Fix a race in nfs_call_unlink()

PATCH New [email protected] 1 participant 1 message Nov 17, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 NFS: Fix a race in nfs_call_unlink()

From: Trond Myklebust <[email protected]>

We should check that the filehandles match before transferring the sillyrename data to the newly looked-up dentry in case the name was reused on the server.

---
 fs/nfs/unlink.c | 1 +
 1 file changed, 1 insertion(+)
fs/nfs/unlink.c +1 -0
index 9697cd5d2561..150a953a8be9 100644
@@ -139,6 +139,7 @@ static int nfs_call_unlink(struct dentry *dentry, struct inode *inode, struct nf
 		 */
 		spin_lock(&alias->d_lock);
 		if (d_really_is_positive(alias) &&
+		    !nfs_compare_fh(NFS_FH(inode), NFS_FH(d_inode(alias))) &&
 		    !(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
 			devname_garbage = alias->d_fsdata;
 			alias->d_fsdata = data;
Signature · 1 line
2.38.1