git: 898e02d74074 - stable/13 - smartpqi: Drop spinlock before freeing memory
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Feb 2024 04:50:02 UTC
The branch stable/13 has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=898e02d740741d13a8948cbad4e0d969a768fd30
commit 898e02d740741d13a8948cbad4e0d969a768fd30
Author: John F. Carr <jfc@mit.edu>
AuthorDate: 2023-10-19 03:02:42 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-19 04:07:04 +0000
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)
---
sys/dev/smartpqi/smartpqi_discovery.c | 3 +--
1 file changed, 1 insertion(+), 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 */