DF-0196 / fix.diff
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -144,10 +144,20 @@ if (ds == NULL) return; + struct devstat *d; + + devstat_head = &device_statq; + + /* Only remove (and decrement) if ds is actually on the queue. */ + STAILQ_FOREACH(d, devstat_head, dev_links) { + if (d == ds) + break; + } + if (d == NULL) + return; + devstat_generation++; devstat_num_devs--; - - devstat_head = &device_statq; /* Remove this entry from the devstat queue */ STAILQ_REMOVE(devstat_head, ds, devstat, dev_links); |