mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
hostinet: fix fd leak in fdnotifier for VFS2
When we failed to create the new socket after adding the fd to fdnotifier, we should remove the fd from fdnotifier, because we are going to close the fd directly. Fixes: #3241 Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
This commit is contained in:
@@ -71,6 +71,7 @@ func newVFS2Socket(t *kernel.Task, family int, stype linux.SockType, protocol in
|
||||
DenyPWrite: true,
|
||||
UseDentryMetadata: true,
|
||||
}); err != nil {
|
||||
fdnotifier.RemoveFD(int32(s.fd))
|
||||
return nil, syserr.FromError(err)
|
||||
}
|
||||
return vfsfd, nil
|
||||
|
||||
Reference in New Issue
Block a user