presumably this is unneeded since in this code path we are initializing - we have a newly allocated tcon which hasn't been returned to anyone yet so no other threads could update those fields (until e.g. worker threads or launched which doesn't happen until a few lines lower, or the tcon returned) On Sun, Nov 26, 2023 at 11:23 PM Pierre Mariani <pierre.mariani@xxxxxxxxx> wrote: > > 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 f7d436daaa80..26e3eeda0c4c 100644 > --- a/fs/smb/client/connect.c > +++ b/fs/smb/client/connect.c > @@ -2711,7 +2711,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 > -- Thanks, Steve