aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorSean Bruno <sbruno@FreeBSD.org>2017-01-12 16:24:10 +0000
committerSean Bruno <sbruno@FreeBSD.org>2017-01-12 16:24:10 +0000
commit25a334104870cd36696d6d988443d981f7f81388 (patch)
treee622cd90d1fdbd2c705ba10cf560d5a41601c492 /sys/dev
parentc6e3715fbc88e01ad68b7e9e12247e0257b94844 (diff)
downloadsrc-25a334104870cd36696d6d988443d981f7f81388.tar.gz
src-25a334104870cd36696d6d988443d981f7f81388.zip
Fix panic on mb_free_ext() due to NULL destructor.
This used to happen because of the SET_MBUF_DESTRUCTOR() called on unregif. Submitted by: Vincenzo Maffione <v.maffione@gmail.com>
Notes
Notes: svn path=/head/; revision=311986
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/netmap/netmap_generic.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c
index 87072069fbcf..cb1cff1f0e71 100644
--- a/sys/dev/netmap/netmap_generic.c
+++ b/sys/dev/netmap/netmap_generic.c
@@ -165,12 +165,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int len)
* has a KASSERT(), checking that the mbuf dtor function is not NULL.
*/
+static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { }
+
#define SET_MBUF_DESTRUCTOR(m, fn) do { \
- (m)->m_ext.ext_free = (void *)fn; \
+ (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \
} while (0)
-static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { }
-
static inline struct mbuf *
nm_os_get_mbuf(struct ifnet *ifp, int len)
{