Skip to content

Commit 446e214

Browse files
committed
cifs: protect srv_count with cifs_tcp_ses_lock
Updates to the srv_count field are protected elsewhere with the cifs_tcp_ses_lock spinlock. Add one missing place (cifs_get_tcp_sesion). CC: Shyam Prasad N <[email protected]> Addresses-Coverity: 1494149 ("Data Race Condition") Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0226487 commit 446e214

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/cifs/connect.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,8 +1452,10 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
14521452
tcp_ses->max_in_flight = 0;
14531453
tcp_ses->credits = 1;
14541454
if (primary_server) {
1455+
spin_lock(&cifs_tcp_ses_lock);
14551456
++primary_server->srv_count;
14561457
tcp_ses->primary_server = primary_server;
1458+
spin_unlock(&cifs_tcp_ses_lock);
14571459
}
14581460
init_waitqueue_head(&tcp_ses->response_q);
14591461
init_waitqueue_head(&tcp_ses->request_q);

0 commit comments

Comments
 (0)