wg_input: avoid leaking due to an m_defrag failure
m_defrag() will not free the chain on failure, leaking the mbuf. Obtained from: OpenBSD MFC after: 3 days
This commit is contained in:
parent
d9a50109e2
commit
df55485085
@ -1905,7 +1905,13 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb,
|
||||
|
||||
m_adj(m0, hlen);
|
||||
|
||||
if ((m = m_defrag(m0, M_NOWAIT)) == NULL) {
|
||||
/*
|
||||
* Ensure mbuf is contiguous over full length of the packet. This is
|
||||
* done so that we can directly read the handshake values in
|
||||
* wg_handshake, and so we can decrypt a transport packet by passing a
|
||||
* a single buffer to noise_remote_decrypt() in wg_decap.
|
||||
*/
|
||||
if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) {
|
||||
DPRINTF(sc, "DEFRAG fail\n");
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user