aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn F. Carr <jfc@mit.edu>2023-10-19 03:02:42 +0000
committerWarner Losh <imp@FreeBSD.org>2024-02-19 04:07:04 +0000
commit898e02d740741d13a8948cbad4e0d969a768fd30 (patch)
tree4505c5f6b4a7461a2d2c279ceaa3b0d77fd54065
parentd9b466296bdd1aa3b25b0cb6f0f546af21e55c62 (diff)
downloadsrc-898e02d740741d13a8948cbad4e0d969a768fd30.tar.gz
src-898e02d740741d13a8948cbad4e0d969a768fd30.zip
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 is the alternate fix from the box. (this is not a cherry pick of b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547)
-rw-r--r--sys/dev/smartpqi/smartpqi_discovery.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/dev/smartpqi/smartpqi_discovery.c b/sys/dev/smartpqi/smartpqi_discovery.c
index 48243d8fc882..08722a35b707 100644
--- a/sys/dev/smartpqi/smartpqi_discovery.c
+++ b/sys/dev/smartpqi/smartpqi_discovery.c
@@ -1460,10 +1460,9 @@ pqisrc_free_device(pqisrc_softstate_t * softs,pqi_scsi_dev_t *device)
softs->device_list[device->target][device->lun] = NULL;
- pqisrc_device_mem_free(softs, device);
-
OS_RELEASE_SPINLOCK(&softs->devlist_lock);
+ pqisrc_device_mem_free(softs, device);
}
/* Update the newly added devices to the device list */