From nobody Thu Oct 19 21:41:00 2023 X-Original-To: dev-commits-src-branches@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 4SBLkN5svjz4xvWw; Thu, 19 Oct 2023 21:41:00 +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 4SBLkN5MQYz4Q08; Thu, 19 Oct 2023 21:41:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697751660; 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=YIJlqx4jEqZ2JQcY8Vmbl+xM8h4us3hwkJSFQz1DO8o=; b=Ecd0ME2IUshRSpBf7MgUcYe+Q+Ji1ProqWqNoyjzqqdU4MyIs+TaYQw+r1vZQ92UY5pRw7 //ZwmGqv1fPudpWODnU85ndvv1FSDlRLp+lO9mcy/2AKrol4Q99wqWtVfeLrY2hlKwZE+j N2R5gwfYx03e0JpL7X3/noYXVIxJGLS1nCGv/SOE75qfVWdOsVyCfoAdQNpYMSuPIHzdkd H5cRXNWYKp6GXI0q79/YZuASpIkqbDrwqREj/VYnT8xA0LdQ7vZbRcLVawspaYRws6DSVL 2zMEpcZbX6/XyPhI9g+YUyxr3hYzeeeGimKE/FN/JPDj0gWbmJv4c16ZM4WIjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697751660; a=rsa-sha256; cv=none; b=rPxPmZwbKlJMJk94GjxgBG/7ATbBDmqX3LaT0SPtjP1hNOnjQ/jBeztIubp9R9bxOL0h+V FicKuzKz+oj7j+02jNiqlNPiL81eoZeJiL07+ynJ5bXyrwYYZ6iA/sWAv5pkNW0771glOo mSwhwD7csR9HVxEa5msBHBNBYji/jf2QvL9JC7TncJnundNwjhYzcUMIXLCLCHBFilo9GQ FaCJbaFSuLV9VacjWkIXBQ/BYv6SwhyoPYKjpYA2rZijDpzrDHzwY/UPNQJisvhApXQbOf O+kuo2w3zemiCMCIPnfNO3YoQk1rdncmxxgDDWoajafG4CJ35LDWdTt41Scxag== 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=1697751660; 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=YIJlqx4jEqZ2JQcY8Vmbl+xM8h4us3hwkJSFQz1DO8o=; b=Anmu+o9XjsySDWds6neEJ5BFhm7VnG7FG3YB8XvjykZQPVFnqND3OW328T2SEMoqaR5ZUA 9mAGuh8pKC//o3kFGXh0FIDj8qpI3wFOIfBchSNqTOr1/E6M5dkHdk1V4M+8DoTnweh+SK siOwtJjNliDqQR7qmCN5metbH7qpGnM8eDn3pWQtVgWJYwEQVZf1z11C+O7LmlzUPZPi8+ C0g9WxXHJEiQF71951tW+qjg/xxGy2DGK5KSiuo5CMnJ3ujziraI1plpEmcGzLrR3aNQwM R9eIw7G3sgftEx5X72tZym3PQAMje+URaZWDfsTL/5C9A4eYkrBzRjEGg0FvBw== 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 4SBLkN4RHJz15xQ; Thu, 19 Oct 2023 21:41:00 +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 39JLf0Xw002595; Thu, 19 Oct 2023 21:41:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JLf0Ox002592; Thu, 19 Oct 2023 21:41:00 GMT (envelope-from git) Date: Thu, 19 Oct 2023 21:41:00 GMT Message-Id: <202310192141.39JLf0Ox002592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 8fe059425a09 - releng/14.0 - smartpqi: Drop spinlock before freeing memory List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 8fe059425a0919274e2c5b25a6af0568d147518d Auto-Submitted: auto-generated The branch releng/14.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8fe059425a0919274e2c5b25a6af0568d147518d commit 8fe059425a0919274e2c5b25a6af0568d147518d Author: John F. Carr AuthorDate: 2023-10-19 03:25:31 +0000 Commit: Warner Losh CommitDate: 2023-10-19 21:37:29 +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 (cherry picked from commit b064a4c9eed5b1dd2a40fc4fd2cb7e738b681547) (cherry picked from commit 1ad148a68ae74f3372b12b6e66fadf5ade384144) Approved-by: re (gjb) --- 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); - }