]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
cifs: revalidate mapping when we open files for SMB1 POSIX
authorRonnie Sahlberg <lsahlber@redhat.com>
Thu, 25 Mar 2021 06:26:35 +0000 (16:26 +1000)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:53:14 +0000 (09:53 +0200)
BugLink: https://bugs.launchpad.net/bugs/1923415
[ Upstream commit cee8f4f6fcabfdf229542926128e9874d19016d5 ]

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.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
fs/cifs/file.c

index 6d001905c8e51af170559f67b26609af5fb48afc..eef4f22b5e78315e358b28a83f30420f4d87ac7b 100644 (file)
@@ -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);
        }