Skip to content

Commit

Permalink
Add missing mutex lock for race condition fix (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Apr 14, 2023
1 parent 1b01e3e commit 72945e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/k8sclient/k8sclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ func getKubernetesDelegate(client *ClientInfo, net *types.NetworkSelectionElemen
}
}

// acquire lock to access file
if types.ChrootMutex != nil {
types.ChrootMutex.Lock()
defer types.ChrootMutex.Unlock()
}
configBytes, err := netutils.GetCNIConfig(customResource, confdir)
if err != nil {
return nil, resourceMap, err
Expand Down

0 comments on commit 72945e3

Please sign in to comment.