summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/netstack/netstack.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-02-06 02:00:41 +0000
committergVisor bot <gvisor-bot@google.com>2020-02-06 02:00:41 +0000
commitb3a9b1da3837ba2636e621467bb56aad942caf5c (patch)
treed4f6e42a05e10673e0089528ccc6ed5edb6917c4 /pkg/sentry/socket/netstack/netstack.go
parent978eceb6badbbe9e4dea10483920f5c61c4469b0 (diff)
parentf3d95607036b8a502c65aa7b3e8145227274dbbc (diff)
Merge release-20200127.0-84-gf3d9560 (automated)
Diffstat (limited to 'pkg/sentry/socket/netstack/netstack.go')
-rwxr-xr-xpkg/sentry/socket/netstack/netstack.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go
index 049d04bf2..ed2fbcceb 100755
--- a/pkg/sentry/socket/netstack/netstack.go
+++ b/pkg/sentry/socket/netstack/netstack.go
@@ -2229,11 +2229,16 @@ func (s *SocketOperations) coalescingRead(ctx context.Context, dst usermem.IOSeq
var copied int
// Copy as many views as possible into the user-provided buffer.
- for dst.NumBytes() != 0 {
+ for {
+ // Always do at least one fetchReadView, even if the number of bytes to
+ // read is 0.
err = s.fetchReadView()
if err != nil {
break
}
+ if dst.NumBytes() == 0 {
+ break
+ }
var n int
var e error