smartpqi: Drop spinlock before freeing memory

pqisrc_free_device frees the device softc with the os spinlock
held. This causes crashes when devices are removed because the memory
free might sleep (which is prohibited with spin locks held). Drop the
spinlock before releasing the memory.

MFC After: 2 days
PR: 273289
Reviewed by: imp
This commit is contained in:
John F. Carr 2023-10-18 21:02:42 -06:00 committed by Warner Losh
parent 767c97c501
commit b064a4c9ee

View file

@ -1671,11 +1671,11 @@ pqisrc_free_device(pqisrc_softstate_t * softs, pqi_scsi_dev_t *device)
pqisrc_delete_softs_entry(softs, device);
DBG_NOTE("Removed memory for device : B %d: T %d: L %d\n",
device->bus, device->target, device->lun);
OS_RELEASE_SPINLOCK(&softs->devlist_lock);
pqisrc_device_mem_free(softs, device);
} else {
OS_RELEASE_SPINLOCK(&softs->devlist_lock);
}
OS_RELEASE_SPINLOCK(&softs->devlist_lock);
}