diff options
author | Ting-Yu Wang <anivia@google.com> | 2020-04-09 17:59:30 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-09 18:00:33 -0700 |
commit | c9195349c9ac24ccb538e92b308225dfa4184c42 (patch) | |
tree | b69529b85d8061313768929adb5c10787151ad1c /pkg | |
parent | 257225c34b81ff0d0b5ce8ae333f5905f9e86cce (diff) |
Replace type assertion with TaskFromContext.
This should fix panic at aio callback.
PiperOrigin-RevId: 305798549
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/socket/netstack/netstack.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go index 20e3fa0d2..7ac38764d 100644 --- a/pkg/sentry/socket/netstack/netstack.go +++ b/pkg/sentry/socket/netstack/netstack.go @@ -535,7 +535,7 @@ func (s *SocketOperations) Write(ctx context.Context, _ *fs.File, src usermem.IO } if resCh != nil { - t := ctx.(*kernel.Task) + t := kernel.TaskFromContext(ctx) if err := t.Block(resCh); err != nil { return 0, syserr.FromError(err).ToError() } @@ -608,7 +608,7 @@ func (s *SocketOperations) ReadFrom(ctx context.Context, _ *fs.File, r io.Reader } if resCh != nil { - t := ctx.(*kernel.Task) + t := kernel.TaskFromContext(ctx) if err := t.Block(resCh); err != nil { return 0, syserr.FromError(err).ToError() } |