Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jan 2017 16:24:10 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311986 - head/sys/dev/netmap
Message-ID:  <201701121624.v0CGOApg049349@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.maffione@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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701121624.v0CGOApg049349>