diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2019-06-05 10:38:38 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-16 08:22:15 +0200 |
commit | acc07941e2240af16a922dc38149bae1628aee93 (patch) | |
tree | 43c84e7d73d4e137442b0a31987e98828c61ea4c /fs/cifs/cifsfs.c | |
parent | 1d0648767ccf02dc3f6f8aa49d6084f661097f38 (diff) | |
download | linux-rt-acc07941e2240af16a922dc38149bae1628aee93.tar.gz |
cifs: add spinlock for the openFileList to cifsInodeInfo
[ Upstream commit 487317c99477d00f22370625d53be3239febabbe ]
We can not depend on the tcon->open_file_lock here since in multiuser mode
we may have the same file/inode open via multiple different tcons.
The current code is race prone and will crash if one user deletes a file
at the same time a different user opens/create the file.
To avoid this we need to have a spinlock attached to the inode and not the tcon.
RHBZ: 1580165
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index fb32f3d6925e..64e3888f30e6 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -292,6 +292,7 @@ cifs_alloc_inode(struct super_block *sb) cifs_inode->uniqueid = 0; cifs_inode->createtime = 0; cifs_inode->epoch = 0; + spin_lock_init(&cifs_inode->open_file_lock); generate_random_uuid(cifs_inode->lease_key); /* |