device: lock elem in autodraining queue before freeing
Without this, we wind up freeing packets that the encryption/decryption queues still have, resulting in a UaF. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
6548a682a9
commit
4b5d15ec2b
|
@ -89,6 +89,7 @@ func newAutodrainingInboundQueue(device *Device) chan *QueueInboundElement {
|
||||||
if elem == nil {
|
if elem == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
elem.Lock()
|
||||||
device.PutMessageBuffer(elem.buffer)
|
device.PutMessageBuffer(elem.buffer)
|
||||||
device.PutInboundElement(elem)
|
device.PutInboundElement(elem)
|
||||||
default:
|
default:
|
||||||
|
@ -118,6 +119,7 @@ func newAutodrainingOutboundQueue(device *Device) chan *QueueOutboundElement {
|
||||||
if elem == nil {
|
if elem == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
elem.Lock()
|
||||||
device.PutMessageBuffer(elem.buffer)
|
device.PutMessageBuffer(elem.buffer)
|
||||||
device.PutOutboundElement(elem)
|
device.PutOutboundElement(elem)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue