cifs: add spinlock for the openFileList to cifsInodeInfo
authorRonnie Sahlberg <lsahlber@redhat.com>
Wed, 5 Jun 2019 00:38:38 +0000 (10:38 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Sep 2019 06:22:15 +0000 (08:22 +0200)
commitacc07941e2240af16a922dc38149bae1628aee93
tree43c84e7d73d4e137442b0a31987e98828c61ea4c
parent1d0648767ccf02dc3f6f8aa49d6084f661097f38
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>
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/file.c