aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2008-09-30 04:52:30 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2008-09-30 04:52:30 +0000
commitad415775a173a3a22fd1322acd381b9e17f3c123 (patch)
tree8a8dc42ad71c5650f5a902cec0c91999a04e3f88
parent925da971b87e20c7639c0b3848beaac9a968507e (diff)
downloadsrc-ad415775a173a3a22fd1322acd381b9e17f3c123.tar.gz
src-ad415775a173a3a22fd1322acd381b9e17f3c123.zip
If mbuf is not writable get a writable copy before invoking
m_pullup(9). Tested by: Garrett Cooper < yanefbsd <at> gmail dot com >
Notes
Notes: svn path=/head/; revision=183486
-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 cd0512ef6689..cccabcf09116 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);