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 06:59:36 +0000
commitda2e35b0ec99e979963923ed6392b3e883f40eb2 (patch)
tree21560f201cc3e2a1a79ce4672cf0d65072cc30ea
parentc6edb21e3763b55b4102cb08d62a51abcf3cbd4c (diff)
downloadsrc-da2e35b0ec99e979963923ed6392b3e883f40eb2.tar.gz
src-da2e35b0ec99e979963923ed6392b3e883f40eb2.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) (cherry picked from commit 898e02d740741d13a8948cbad4e0d969a768fd30) Approved-by: re (cperciva)
-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 */