summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/fdbased/endpoint.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2020-03-16 08:02:05 -0700
committergVisor bot <gvisor-bot@google.com>2020-03-16 08:03:27 -0700
commit52758e16e0d1e67b3cdd56e04abfce663607ac42 (patch)
tree0a801c9546e5bfc7739d6e55abc40f6b76335630 /pkg/tcpip/link/fdbased/endpoint.go
parent97127750289b49dd5e29f8ddb4209137e47fe52d (diff)
Prevent vnetHdr from escaping in WritePacket.
PiperOrigin-RevId: 301157950
Diffstat (limited to 'pkg/tcpip/link/fdbased/endpoint.go')
-rw-r--r--pkg/tcpip/link/fdbased/endpoint.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/tcpip/link/fdbased/endpoint.go b/pkg/tcpip/link/fdbased/endpoint.go
index a753fb243..3b36b9673 100644
--- a/pkg/tcpip/link/fdbased/endpoint.go
+++ b/pkg/tcpip/link/fdbased/endpoint.go
@@ -407,7 +407,6 @@ func (e *endpoint) WritePacket(r *stack.Route, gso *stack.GSO, protocol tcpip.Ne
if e.Capabilities()&stack.CapabilityHardwareGSO != 0 {
vnetHdr := virtioNetHdr{}
- vnetHdrBuf := vnetHdrToByteSlice(&vnetHdr)
if gso != nil {
vnetHdr.hdrLen = uint16(pkt.Header.UsedLength())
if gso.NeedsCsum {
@@ -428,6 +427,7 @@ func (e *endpoint) WritePacket(r *stack.Route, gso *stack.GSO, protocol tcpip.Ne
}
}
+ vnetHdrBuf := vnetHdrToByteSlice(&vnetHdr)
return rawfile.NonBlockingWrite3(e.fds[0], vnetHdrBuf, pkt.Header.View(), pkt.Data.ToView())
}