Replace type assertion with TaskFromContext.

This should fix panic at aio callback.

PiperOrigin-RevId: 305798549
This commit is contained in:
Ting-Yu Wang
2020-04-09 18:00:33 -07:00
committed by gVisor bot
parent 257225c34b
commit c9195349c9
+2 -2
View File
@@ -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()
}