summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2008-09-30 04:52:30 +0000
committeryongari <yongari@FreeBSD.org>2008-09-30 04:52:30 +0000
commit8468f28e4d50d828c26031aaa0ae583d1e74743d (patch)
tree8a8dc42ad71c5650f5a902cec0c91999a04e3f88 /sys/dev
parentb708fede3f331ec2aef186b4eab3eb9706e90b6b (diff)
downloadFreeBSD-src-8468f28e4d50d828c26031aaa0ae583d1e74743d.zip
FreeBSD-src-8468f28e4d50d828c26031aaa0ae583d1e74743d.tar.gz
If mbuf is not writable get a writable copy before invoking
m_pullup(9). Tested by: Garrett Cooper < yanefbsd <at> gmail dot com >
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/msk/if_msk.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c
index cd0512e..cccabcf 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -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);
OpenPOWER on IntegriCloud