Change order of ifp release on ENA detach
In rare case, when the ifconfig is called just before kldunload, it is possible, that ena_up routine will be called after queue locks are released. To prevent that, ifp is detached before the last ena_down is called and further, the ifp is freed at the end of the function. Submitted by: Michal Krawczyk <mk@semihalf.com> Obtained from: Semihalf Sponsored by: Amazon, Inc.
This commit is contained in:
parent
2b5b60fe0d
commit
9151c55d02
@ -3893,6 +3893,8 @@ ena_detach(device_t pdev)
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
ether_ifdetach(adapter->ifp);
|
||||
|
||||
/* Free reset task and callout */
|
||||
callout_drain(&adapter->timer_service);
|
||||
while (taskqueue_cancel(adapter->reset_tq, &adapter->reset_task, NULL))
|
||||
@ -3903,11 +3905,6 @@ ena_detach(device_t pdev)
|
||||
ena_down(adapter);
|
||||
sx_unlock(&adapter->ioctl_sx);
|
||||
|
||||
if (adapter->ifp != NULL) {
|
||||
ether_ifdetach(adapter->ifp);
|
||||
if_free(adapter->ifp);
|
||||
}
|
||||
|
||||
ena_free_all_io_rings_resources(adapter);
|
||||
|
||||
ena_free_counters((counter_u64_t *)&adapter->hw_stats,
|
||||
@ -3949,6 +3946,8 @@ ena_detach(device_t pdev)
|
||||
mtx_destroy(&adapter->global_mtx);
|
||||
sx_destroy(&adapter->ioctl_sx);
|
||||
|
||||
if_free(adapter->ifp);
|
||||
|
||||
if (ena_dev->bus != NULL)
|
||||
free(ena_dev->bus, M_DEVBUF);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user