get_polling_cfg() does not check the first CPU in single-CPU mode, and
in multi-CPU mode its ring check can overflow, so a request can name
CPUs or rings that do not exist. Check that the CPUs are in range.
Starting or stopping polling on a NIC whose driver has detached calls
the driver's nm_intr method, which uses the driver's softc after it has
been freed. Refuse to start polling on such a NIC, and do not call
nm_intr from nma_intr_enable() once the driver is gone.
The loops that undo a partial nm_bdg_create_kthreads() or
nm_bdg_polling_start_kthreads() use the index of the entry that failed
instead of the loop counter, so they never reach the entries before it.
When the kthreads fail to start, nm_bdg_ctl_polling_start() frees the
array of kthreads but not the contexts in it, and stopping polling never
frees the array. Use the loop counter, delete the contexts on the error
path and free the array together with the contexts.
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")