freebsd_network: Always hold the "Giant" lock during attaches.

Reduces patches to OpenBSD drivers slightly, and could potentially
help with some of the KDLs.
This commit is contained in:
Augustin Cavalier 2022-06-13 23:48:43 -04:00
parent e6da31ae5d
commit e206b2f350
3 changed files with 4 additions and 4 deletions

View File

@ -11028,9 +11028,7 @@ iwx_attach(struct device *parent, struct device *self, void *aux)
ic->ic_ampdu_tx_stop = NULL;
#ifdef __HAIKU__
mtx_lock(&Giant);
iwx_preinit(sc);
mtx_unlock(&Giant);
#else
/*
* We cannot read the MAC address without loading the

View File

@ -12124,9 +12124,7 @@ iwm_attach(struct device *parent, struct device *self, void *aux)
ic->ic_ampdu_tx_start = iwm_ampdu_tx_start;
ic->ic_ampdu_tx_stop = iwm_ampdu_tx_stop;
#ifdef __HAIKU__
mtx_lock(&Giant);
iwm_preinit(sc);
mtx_unlock(&Giant);
#else
/*
* We cannot read the MAC address without loading the

View File

@ -481,6 +481,9 @@ device_attach(device_t device)
|| device->methods.attach == NULL)
return B_ERROR;
// Always hold the giant lock during attach.
mtx_lock(&Giant);
result = device->methods.attach(device);
if (result == 0)
@ -489,6 +492,7 @@ device_attach(device_t device)
if (result == 0 && HAIKU_DRIVER_REQUIRES(FBSD_WLAN_FEATURE))
result = start_wlan(device);
mtx_unlock(&Giant);
return result;
}