Skip to content

Commit

Permalink
Merge pull request #1351 from tyler92/fix-panic-in-layers
Browse files Browse the repository at this point in the history
Fix accessing to layer without lock
  • Loading branch information
rhatdan committed Sep 27, 2022
2 parents 6fe129c + e35b061 commit d9e14ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ func (s *store) newLayerStore(rundir string, layerdir string, driver drivers.Dri
uidMap: copyIDMap(s.uidMap),
gidMap: copyIDMap(s.gidMap),
}
rlstore.Lock()
defer rlstore.Unlock()
if err := rlstore.Load(); err != nil {
return nil, err
}
Expand All @@ -584,6 +586,8 @@ func newROLayerStore(rundir string, layerdir string, driver drivers.Driver) (ROL
bymount: make(map[string]*Layer),
byname: make(map[string]*Layer),
}
rlstore.RLock()
defer rlstore.Unlock()
if err := rlstore.Load(); err != nil {
return nil, err
}
Expand Down

0 comments on commit d9e14ec

Please sign in to comment.