Fix regression in r296242 affecting several drivers. For EXT_NET_DRV,

EXT_MOD_TYPE, EXT_DISPOSABLE types we should first execute the free
callback, then free the mbuf, otherwise we will derefernce memory that
was just freed.

Reported and tested:	jhibbits
This commit is contained in:
glebius 2016-03-02 02:12:01 +00:00
parent 0e614805cd
commit a6bfbefef5

View File

@ -677,8 +677,12 @@ mb_free_ext(struct mbuf *m)
case EXT_NET_DRV:
case EXT_MOD_TYPE:
case EXT_DISPOSABLE:
KASSERT(m->m_ext.ext_free != NULL,
("%s: ext_free not set", __func__));
(*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1,
m->m_ext.ext_arg2);
uma_zfree(zone_mbuf, mref);
/* FALLTHROUGH */
break;
case EXT_EXTREF:
KASSERT(m->m_ext.ext_free != NULL,
("%s: ext_free not set", __func__));