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:
@@ -11028,9 +11028,7 @@ iwx_attach(struct device *parent, struct device *self, void *aux)
|
|||||||
ic->ic_ampdu_tx_stop = NULL;
|
ic->ic_ampdu_tx_stop = NULL;
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
mtx_lock(&Giant);
|
|
||||||
iwx_preinit(sc);
|
iwx_preinit(sc);
|
||||||
mtx_unlock(&Giant);
|
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* We cannot read the MAC address without loading the
|
* We cannot read the MAC address without loading the
|
||||||
|
|||||||
@@ -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_start = iwm_ampdu_tx_start;
|
||||||
ic->ic_ampdu_tx_stop = iwm_ampdu_tx_stop;
|
ic->ic_ampdu_tx_stop = iwm_ampdu_tx_stop;
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
mtx_lock(&Giant);
|
|
||||||
iwm_preinit(sc);
|
iwm_preinit(sc);
|
||||||
mtx_unlock(&Giant);
|
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* We cannot read the MAC address without loading the
|
* We cannot read the MAC address without loading the
|
||||||
|
|||||||
@@ -481,6 +481,9 @@ device_attach(device_t device)
|
|||||||
|| device->methods.attach == NULL)
|
|| device->methods.attach == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
// Always hold the giant lock during attach.
|
||||||
|
mtx_lock(&Giant);
|
||||||
|
|
||||||
result = device->methods.attach(device);
|
result = device->methods.attach(device);
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
@@ -489,6 +492,7 @@ device_attach(device_t device)
|
|||||||
if (result == 0 && HAIKU_DRIVER_REQUIRES(FBSD_WLAN_FEATURE))
|
if (result == 0 && HAIKU_DRIVER_REQUIRES(FBSD_WLAN_FEATURE))
|
||||||
result = start_wlan(device);
|
result = start_wlan(device);
|
||||||
|
|
||||||
|
mtx_unlock(&Giant);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user