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:
Gleb Smirnoff 2016-03-02 02:12:01 +00:00
parent 9e5c6042f9
commit 0ea37a86ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296292

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__));