diff options
author | John F. Carr <jfc@mit.edu> | 2023-10-19 03:02:42 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2023-10-19 03:06:40 +0000 |
commit | b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547 (patch) | |
tree | 76fc65fea8fb44229aacd961b846c7aafe2254c3 | |
parent | 767c97c501ae72eb3d74bc23ddf5a1d570d8f841 (diff) | |
download | src-b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547.tar.gz src-b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547.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
-rw-r--r-- | sys/dev/smartpqi/smartpqi_discovery.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/smartpqi/smartpqi_discovery.c b/sys/dev/smartpqi/smartpqi_discovery.c index 7e084a81cd89..ac37c2233762 100644 --- a/sys/dev/smartpqi/smartpqi_discovery.c +++ b/sys/dev/smartpqi/smartpqi_discovery.c @@ -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); - } |