mirror of https://github.com/golang/go.git
net/http/fcgi: fix race in child.serve connection read
Guards the connection read with a mutex, because typeStdin asynchronously and concurrently writes to the underlying conn. Fixes #41167 Change-Id: Ia2610f4fde0bd4b108c54164095ea293980b0301 Reviewed-on: https://go-review.googlesource.com/c/go/+/252417 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
This commit is contained in:
parent
b246c0e12f
commit
7432bee7b3
|
|
@ -155,9 +155,12 @@ func (c *child) serve() {
|
|||
defer c.cleanUp()
|
||||
var rec record
|
||||
for {
|
||||
c.conn.mutex.Lock()
|
||||
if err := rec.read(c.conn.rwc); err != nil {
|
||||
c.conn.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
c.conn.mutex.Unlock()
|
||||
if err := c.handleRecord(&rec); err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue