iflib_device_register() calls ether_ifattach() without the context
lock, and when registration fails after that point it drops the lock
again to drain the tasks and detach the interface. An ioctl can take
the lock in either window and start the interface: iflib_init_locked()
checks the power state, which the failure path leaves active, but not
IFC_IN_DETACH. The cleanup then detaches the tasks and frees the
queues while the interface is running, with its interrupts still
enabled and the device still able to DMA into the freed rings.
Mark the context suspending before dropping the lock, as
iflib_device_deregister() does, so that nothing can start the
interface once the failure is being handled, and stop the interface
after ether_ifdetach() if it was started before then. An interface
that was never started is not passed to iflib_stop(), so the usual
failure path still does not call the driver's stop method.
MFC after: 2 weeks
MFC to: stable/15
Sponsored by: Rubicon Communications, LLC ("Netgate")