mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-25 18:51:01 +00:00
prober: fix nil pointer access in tcp-in-tcp probes
If unable to accept a connection from the bandwidth probe listener, return from the goroutine immediately since the accepted connection will be nil. Updates tailscale/corp#25958 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
parent
7f3c1932b5
commit
2729942638
@ -1048,6 +1048,7 @@ func derpProbeBandwidthTUN(ctx context.Context, transferTimeSeconds, totalBytesT
|
|||||||
readConn, err := l.Accept()
|
readConn, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
readFinishedC <- err
|
readFinishedC <- err
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer readConn.Close()
|
defer readConn.Close()
|
||||||
deadline, ok := ctx.Deadline()
|
deadline, ok := ctx.Deadline()
|
||||||
@ -1055,6 +1056,7 @@ func derpProbeBandwidthTUN(ctx context.Context, transferTimeSeconds, totalBytesT
|
|||||||
// Don't try reading past our context's deadline.
|
// Don't try reading past our context's deadline.
|
||||||
if err := readConn.SetReadDeadline(deadline); err != nil {
|
if err := readConn.SetReadDeadline(deadline); err != nil {
|
||||||
readFinishedC <- fmt.Errorf("unable to set read deadline: %w", err)
|
readFinishedC <- fmt.Errorf("unable to set read deadline: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n, err := io.CopyN(io.Discard, readConn, size)
|
n, err := io.CopyN(io.Discard, readConn, size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user