Replace TaskFromContext(ctx).Kernel() with KernelFromContext(ctx)

Panic seen at some code path like control.ExecAsync where
ctx does not have a Task.

Reported-by: syzbot+55ce727161cf94a7b7d6@syzkaller.appspotmail.com
PiperOrigin-RevId: 355960596
This commit is contained in:
Ting-Yu Wang
2021-02-05 17:28:01 -08:00
committed by gVisor bot
parent 09afd68326
commit 120c8e3468
4 changed files with 25 additions and 6 deletions
+1 -2
View File
@@ -79,8 +79,7 @@ func NewVFS2(t *kernel.Task, family int, skType linux.SockType, protocol int, qu
// Release implements vfs.FileDescriptionImpl.Release.
func (s *SocketVFS2) Release(ctx context.Context) {
t := kernel.TaskFromContext(ctx)
t.Kernel().DeleteSocketVFS2(&s.vfsfd)
kernel.KernelFromContext(ctx).DeleteSocketVFS2(&s.vfsfd)
s.socketOpsCommon.Release(ctx)
}