Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163531922
D44371.id135781.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44371.id135781.diff
View Options
diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c
--- a/sys/dev/netmap/netmap_generic.c
+++ b/sys/dev/netmap/netmap_generic.c
@@ -257,6 +257,7 @@
mtx_lock_spin(&kring->tx_event_lock);
if (kring->tx_event) {
SET_MBUF_DESTRUCTOR(kring->tx_event, NULL);
+ kring->tx_event->m_ext.ext_arg1 = NULL;
}
kring->tx_event = NULL;
mtx_unlock_spin(&kring->tx_event_lock);
@@ -278,7 +279,8 @@
for (i=0; i<na->num_tx_desc; i++) {
if (kring->tx_pool[i]) {
- m_freem(kring->tx_pool[i]);
+ m_free(kring->tx_pool[i]);
+ kring->tx_pool[i] = NULL;
}
}
nm_os_free(kring->tx_pool);
@@ -434,7 +436,7 @@
static void
generic_mbuf_dtor(struct mbuf *m)
{
- struct netmap_adapter *na = NA(GEN_TX_MBUF_IFP(m));
+ struct netmap_adapter *na = (struct netmap_adapter *)m->m_ext.ext_arg1;
struct netmap_kring *kring;
unsigned int r = MBUF_TXQ(m);
unsigned int r_orig = r;
@@ -639,6 +641,10 @@
}
SET_MBUF_DESTRUCTOR(m, generic_mbuf_dtor);
+
+ /* Take a reference to the adapter so we have it on free. */
+ m->m_ext.ext_arg1 = kring->na;
+
kring->tx_event = m;
#ifdef __FreeBSD__
/*
@@ -664,7 +670,7 @@
/* Decrement the refcount. This will free it if we lose the race
* with the driver. */
- m_freem(m);
+ m_free(m);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 25, 5:04 AM (11 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35463093
Default Alt Text
D44371.id135781.diff (1 KB)
Attached To
Mode
D44371: netmap: Address errors on memory free in netmap_generic
Attached
Detach File
Event Timeline
Log In to Comment