diff options
author | Steve French <stfrench@microsoft.com> | 2021-06-25 21:54:32 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-06-25 22:02:26 +0300 |
commit | 0fa757b5d3ea6e3d3d59f0e0d34c8214b8643b8f (patch) | |
tree | 83689a1450ff250ade3184454d140f451b9c1d21 /fs/cifs/smb2ops.c | |
parent | 0060a4f28a9ef45ae8163c0805e944a2b1546762 (diff) | |
download | linux-0fa757b5d3ea6e3d3d59f0e0d34c8214b8643b8f.tar.xz |
smb3: prevent races updating CurrentMid
There was one place where we weren't locking CurrentMid, and although
likely to be safe since even without the lock since it is during
negotiate protocol, it is more consistent to lock it in this last remaining
place, and avoids confusing Coverity warning.
Addresses-Coverity: 1486665 ("Data race condition")
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 903de7449aa3..e4c8f603dd58 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -388,7 +388,9 @@ smb2_negotiate(const unsigned int xid, struct cifs_ses *ses) { int rc; + spin_lock(&GlobalMid_Lock); cifs_ses_server(ses)->CurrentMid = 0; + spin_unlock(&GlobalMid_Lock); rc = SMB2_negotiate(xid, ses); /* BB we probably don't need to retry with modern servers */ if (rc == -EAGAIN) |