mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
If mbuf is not writable get a writable copy before invoking
m_pullup(9). Tested by: Garrett Cooper < yanefbsd <at> gmail dot com >
This commit is contained in:
parent
925da971b8
commit
ad415775a1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183486
|
@ -2559,7 +2559,16 @@ msk_encap(struct msk_if_softc *sc_if, struct mbuf **m_head)
|
|||
struct ip *ip;
|
||||
struct tcphdr *tcp;
|
||||
|
||||
/* TODO check for M_WRITABLE(m) */
|
||||
if (M_WRITABLE(m) == 0) {
|
||||
/* Get a writable copy. */
|
||||
m = m_dup(*m_head, M_DONTWAIT);
|
||||
m_freem(*m_head);
|
||||
if (m == NULL) {
|
||||
*m_head = NULL;
|
||||
return (ENOBUFS);
|
||||
}
|
||||
*m_head = m;
|
||||
}
|
||||
|
||||
offset = sizeof(struct ether_header);
|
||||
m = m_pullup(m, offset);
|
||||
|
|
Loading…
Reference in a new issue