Skip to content

Commit 8094a60

Browse files
author
Steve French
committed
smb3: missing lock when picking channel
Coverity spotted a place where we should have been holding the channel lock when accessing the ses channel index. Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)") Cc: [email protected] Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 9a1f1d0 commit 8094a60

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/smb/client/transport.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,11 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
10571057
index = (uint)atomic_inc_return(&ses->chan_seq);
10581058
index %= ses->chan_count;
10591059
}
1060+
1061+
server = ses->chans[index].server;
10601062
spin_unlock(&ses->chan_lock);
10611063

1062-
return ses->chans[index].server;
1064+
return server;
10631065
}
10641066

10651067
int

0 commit comments

Comments
 (0)