Author: sbruno
Date: Thu Jan 12 16:24:10 2017
New Revision: 311986
URL: https://svnweb.freebsd.org/changeset/base/311986

Log:
  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.maffi...@gmail.com>

Modified:
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_generic.c
==============================================================================
--- head/sys/dev/netmap/netmap_generic.c        Thu Jan 12 16:22:28 2017        
(r311985)
+++ head/sys/dev/netmap/netmap_generic.c        Thu Jan 12 16:24:10 2017        
(r311986)
@@ -165,12 +165,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int le
  * 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)
 {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to