[PATCH 3/4] smb: client: Protect tcon->status with tc_lock spin lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Protect the update of tcon->status with tc_lock spin lock as per documentation
from cifsglob.h.
Fixes Coverity 1560722 Data race condition.

Signed-off-by: Pierre Mariani <pierre.mariani@xxxxxxxxx>
---
 fs/smb/client/connect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 0512835f399c..a381c4cdb8c4 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2710,7 +2710,9 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 	tcon->nodelete = ctx->nodelete;
 	tcon->local_lease = ctx->local_lease;
 	INIT_LIST_HEAD(&tcon->pending_opens);
+	spin_lock(&tcon->tc_lock);
 	tcon->status = TID_GOOD;
+	spin_unlock(&tcon->tc_lock);
 
 	INIT_DELAYED_WORK(&tcon->query_interfaces,
 			  smb2_query_server_interfaces);
-- 
2.39.2





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux