From nobody Thu Oct 19 03:06:35 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S9t0W6Gdqz4xs9K; Thu, 19 Oct 2023 03:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S9t0W5hdxz4G0t; Thu, 19 Oct 2023 03:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697684795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ldDNF1NLrGBoEK4yuDeRfIjllSsYCEa5s5XvH4C+1h0=; b=xKXELo2g8kvJQmNsY1osQSL273USc1TkK/lI6bsxbpgM/jdAn2Ul18qBDq6t3poz/OQYJx N2zYXzmnPUbvuANz4e8wgp1gJvrM9Pm2Z0wsjHItg6RdsR6e2K5heqluCxRGhvKoU4/a7p /IrSIyzD+Lhpe5he1m9iCZaao7IDOacY9nJb0+8zp1lwOBR+RazHrCBDdd9aBbMf+JoNP/ 5KeJpAyi3LCELzAxa0m99c0fwqDUcsGWMjT7eu9YVvmJ/9RVny3BSKHYobNFiOOcyYGs4K xMzTb6z7Hwm0RXsfNCUt0wTQEichyKslqeR2ENuj0C/4RSJRc+o8n6wdDOm5cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697684795; a=rsa-sha256; cv=none; b=XXV05V6f265TbehnxeEWjG0+19NJxS68I8+X+R+oqvkHcl4vBEeuhYCQjO9srba91TUZrT xtylvQ36bh8cd0B0gHhnDYjvjvKVw6cWlMK5rTr6adiBM07v0BdIc0ll+g6dba8Pa/4yvo hro+OAol1zEwBj2uhROCwQlPLyjQLa0gwumMseqi2ZN4LDghw4091q4cluWxZdPZXvD9Xq bXAm7BFoH0uWMWNzqvarELkY+mVpS5+hvuk7+n+2p45uhh1WbOsJz2XOHvBBqoRr1X3Dt2 BrgJnt/Lg8z5FVVMUAYgoCx1WRhXH+/5uk5T+DlO3AeZ9LtT/2nSETfw3yCYhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697684795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ldDNF1NLrGBoEK4yuDeRfIjllSsYCEa5s5XvH4C+1h0=; b=ec3yFn/hxL44ecplphwaSBRQco6Z7iTQkVpqMKeJ6q3ir7/wPkDn9wivmYbrU/uLjOFarb OkXDnFfFCGnjLgN9JuiFc8nkuDlwu/OfKDz3Sn2WiRErXSoZpRm0ijwlCfLZF3l73gDE2t ddD7NlPFwp7hc6CrgTcFY0znq8S43PnaOsXg59+Z55IaydwYySM40Ep1IQdPqc9pUqDxAr rq/zxInwsRcatn7Cw1H2DVhvGRwNIOAVrkCSyn6fvaqdXojlOnGCgHNn/2HG4iuelelx3k ko+9TrJrjLtsdc+0Jb/SIGF2K0Mfp/IpOI75U58DRWVp0u3lt8A6uJARn+EJzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S9t0W4lcBzY0c; Thu, 19 Oct 2023 03:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39J36ZEd045471; Thu, 19 Oct 2023 03:06:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39J36ZgW045468; Thu, 19 Oct 2023 03:06:35 GMT (envelope-from git) Date: Thu, 19 Oct 2023 03:06:35 GMT Message-Id: <202310190306.39J36ZgW045468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b064a4c9eed5 - main - smartpqi: Drop spinlock before freeing memory List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547 commit b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547 Author: John F. Carr AuthorDate: 2023-10-19 03:02:42 +0000 Commit: Warner Losh CommitDate: 2023-10-19 03:06:40 +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 --- sys/dev/smartpqi/smartpqi_discovery.c | 6 +++--- 1 file 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); - }