]> git.ipfire.org Git - thirdparty/linux.git/commit
smb: client: fix data corruption due to racy lease checks
authorPaulo Alcantara <pc@manguebit.org>
Thu, 12 Feb 2026 22:53:07 +0000 (19:53 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 12 Feb 2026 23:49:55 +0000 (17:49 -0600)
commit4c91b67f87ac032c77650108ef9841772b9dc364
tree2dfd545596eb5279b9ec4ede0eb0d10e87af6896
parent3774289f525cba0f33610a390bd6a28bb636b637
smb: client: fix data corruption due to racy lease checks

Customer reported data corruption in some of their files.  It turned
out the client would end up calling cacheless IO functions while
having RHW lease, bypassing the pagecache and then leaving gaps in the
file while writing to it.  It was related to concurrent opens changing
the lease state while having writes in flight.  Lease breaks and
re-opens due to reconnect could also cause same issue.

Fix this by serialising the lease updates with
cifsInodeInfo::open_file_lock.  When handling oplock break, make sure
to use the downgraded oplock value rather than one in cifsInodeinfo as
it could be changed concurrently.

Reported-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsglob.h
fs/smb/client/file.c
fs/smb/client/smb1ops.c
fs/smb/client/smb2misc.c
fs/smb/client/smb2ops.c
fs/smb/client/smb2proto.h