1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:00:04 -07:00

cmd/go/internal/modfetch: add Unlock before return in checkModSum

In cmd/go/internal/modfetch/fetch.go,
`checkModSum()` forgets Unlock before return, which may lead to deadlock.
876c1feb7d/src/cmd/go/internal/modfetch/fetch.go (L514-L520)
The fix is to add `goSum.mu.Unlock()` before return.

Change-Id: I855b1c1bc00aeada2c1e84aabb5328f02823007d
GitHub-Last-Rev: afeb3763dd
GitHub-Pull-Request: golang/go#38563
Reviewed-on: https://go-review.googlesource.com/c/go/+/229219
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
BurtonQin 2020-04-21 11:37:41 +00:00 committed by Jay Conrod
parent af55060b39
commit 4f27e1d7aa

View File

@ -514,6 +514,7 @@ func checkModSum(mod module.Version, h string) error {
goSum.mu.Lock()
inited, err := initGoSum()
if err != nil {
goSum.mu.Unlock()
return err
}
done := inited && haveModSumLocked(mod, h)