Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178059335
D62136.1795874292.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D62136.1795874292.diff
View Options
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -3938,8 +3938,8 @@
}
}
- if (!changed) {
- return 0; /* nothing to do */
+ if (!changed || nm_iszombie(na)) {
+ return 0; /* nothing to do, or the driver is gone */
}
if (!na->nm_intr) {
diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c
--- a/sys/dev/netmap/netmap_bdg.c
+++ b/sys/dev/netmap/netmap_bdg.c
@@ -773,7 +773,7 @@
cleanup:
for (j = 0; j < i; j++) {
- struct nm_bdg_kthread *t = bps->kthreads + i;
+ struct nm_bdg_kthread *t = bps->kthreads + j;
nm_os_kctx_destroy(t->nmk);
}
nm_os_free(bps->kthreads);
@@ -804,7 +804,7 @@
cleanup:
for (j = 0; j < i; j++) {
- struct nm_bdg_kthread *t = bps->kthreads + i;
+ struct nm_bdg_kthread *t = bps->kthreads + j;
nm_os_kctx_worker_stop(t->nmk);
}
bps->stopped = true;
@@ -824,6 +824,8 @@
nm_os_kctx_worker_stop(t->nmk);
nm_os_kctx_destroy(t->nmk);
}
+ nm_os_free(bps->kthreads);
+ bps->kthreads = NULL;
bps->stopped = true;
}
@@ -844,6 +846,10 @@
} else if (req_cpus >= avail_cpus) {
nm_prerr("Cannot use all the CPUs in the system");
return EINVAL;
+ } else if (i >= avail_cpus || req_cpus > avail_cpus - i) {
+ nm_prerr("CPUs %u-%u not in range (have %u CPUs)",
+ i, i + req_cpus - 1, avail_cpus);
+ return EINVAL;
}
if (req->nr_mode == NETMAP_POLLING_MODE_MULTI_CPU) {
@@ -900,6 +906,10 @@
nm_prerr("ERROR adapter already in polling mode");
return EFAULT;
}
+ if (nm_iszombie(bna->hwna)) {
+ nm_prerr("ERROR %s has been detached", bna->hwna->name);
+ return ENXIO;
+ }
bps = nm_os_malloc(sizeof(*bps));
if (!bps)
@@ -927,7 +937,7 @@
error = nm_bdg_polling_start_kthreads(bps);
if (error) {
nm_prerr("ERROR nm_bdg_polling_start_kthread()");
- nm_os_free(bps->kthreads);
+ nm_bdg_polling_stop_delete_kthreads(bps);
nm_os_free(bps);
bna->na_polling_state = NULL;
nma_intr_enable(bna->hwna, 1);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 28, 1:58 PM (13 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42065746
Default Alt Text
D62136.1795874292.diff (1 KB)
Attached To
Mode
D62136: netmap: Fix checks, error paths and a leak in VALE polling
Attached
Detach File
Event Timeline