Skip to contentSkip to conversation

cifs: revalidate mapping when we open files for SMB1 POSIX

PATCH Applied Ronnie Sahlberg 3 participants 3 messages Mar 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: revalidate mapping when we open files for SMB1 POSIX

RHBZ: 1933527

Under SMB1 + POSIX, if an inode is reused on a server after we have read and cached a part of a file, when we then open the new file with the re-cycled inode there is a chance that we may serve the old data out of cache to the application.
This only happens for SMB1 (deprecated) and when posix are used. The simplest solution to avoid this race is to force a revalidate on smb1-posix open.

---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/cifs/file.c +1 -0
index 26de4329d161..042e24aad410 100644
@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
 			goto posix_open_ret;
 		}
 	} else {
+		cifs_revalidate_mapping(*pinode);
 		cifs_fattr_to_inode(*pinode, &fattr);
 	}
 
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Ronnie Sahlberg

RHBZ: 1933527

Under SMB1 + POSIX, if an inode is reused on a server after we have read and cached a part of a file, when we then open the new file with the re-cycled inode there is a chance that we may serve the old data out of cache to the application.
This only happens for SMB1 (deprecated) and when posix are used. The simplest solution to avoid this race is to force a revalidate on smb1-posix open.

Quoted 4 lines
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)
Applied
#2 lore raw

merged into cifs-2.6.git for-next

Quoted 19 lines · Paulo Alcantara
Quoted 10 lines · Ronnie Sahlberg

RHBZ: 1933527

Under SMB1 + POSIX, if an inode is reused on a server after we have read and cached a part of a file, when we then open the new file with the re-cycled inode there is a chance that we may serve the old data out of cache to the application.
This only happens for SMB1 (deprecated) and when posix are used. The simplest solution to avoid this race is to force a revalidate on smb1-posix open.

Quoted 4 lines
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)
Signature · 3 lines
Thanks,

Steve