From nobody Sat Oct 07 00:32:11 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 4S2R7v5cfyz4wB5p; Sat, 7 Oct 2023 00:32:11 +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 4S2R7v4GySz4b3p; Sat, 7 Oct 2023 00:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696638731; 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=MF/7kL+s/frbndNjOGD+Oqj4Zx45clJxJu21VXJaMFA=; b=vRkH9HgTE4CdNXE5zRN94i8n/xQx8rTfurgBa8QeDc7FhKhg6I9b66NV2YeNPgx1ozu/IX UXHVkaaLVbPtkQ4gPQKc16BqBuBlucQ1KOFK7sUgbzF8wQ0FVzQJjofokMcFGNZnET/Xd0 V465rmgeuHzP7G6y1KZs6meEmsNpamzDRoHES+lI+7ZzhHw5faRFZv6s5cWWlPX/+THRq7 PTsmwQwYwk+jSTKYRFsywuE/7ucYmyI164LwKRTQPoRozNiy+4glmd9S1AQXNxyT7FG0Kt 0GqXOtbZyoIH7FEOsIOG1lfNKZQm3IJg3n4bpfZOhQJnJG2pWmfU1HxN3K/bXw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696638731; a=rsa-sha256; cv=none; b=hKJdCMn6MR1qsqKfKZD2M7hVkYw6LknL7l31QT90UYXypCwy66jkuUb+q2C2bt7LExlYAn 9BiFsSoivJ3A6Z52UYRVSQ5WsYgJyrzLRdM80SHOI/PzzXcNw/knknMvBvMdFkwKkNaUfY 9z4hrRlZtc7JI7mJuSIGiN1hUdhYybuxksw1q5stMPCpSqAYtqmd3hoBfMvSRTsbWKOJhw jcM6T08J43M2IGvQwj+CANd3IjQ0AmYIrqCULBO70yuElQF8BLfJng9xHOm3B+vocN+ksK ytdwzHLyBVWdreMP4HQv5iQnBFhT0w9gWaITYzUKElGumQWqm5a4H/ngBAPuhA== 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=1696638731; 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=MF/7kL+s/frbndNjOGD+Oqj4Zx45clJxJu21VXJaMFA=; b=uRAc/DZTS9M4Ets8g+saHT0qBWFNNBibklOJWDx97VnkqcRveVlibRXGJhcHr4mn7OlEQv 34t1nStkxJZaasyMUAmeedx/j4PGTMOqlrawySUx39Ddf3g7jvFvyi+BEcCO6+MwZ9DON9 KeEhilNBTZKbN73Npq1cBgLEsPjDcOhtWmjNis+X8iGAtck350OYybhARvrS+sUuB/LLv2 1b9LqCEMf8Nh/X6xqPQwgzA8Irmy1arWymbQqa28t3FCb21PkvC1kn5Alqrq8Av6PIfLjV H3wot+/XhEru8bqO4k1SJ53STn5xJ9WgR1pMSat6BRhUExRdBN11h5PvzSAc0A== 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 4S2R7v2yJPz18B2; Sat, 7 Oct 2023 00:32:11 +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 3970WBHt005674; Sat, 7 Oct 2023 00:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3970WBCE005671; Sat, 7 Oct 2023 00:32:11 GMT (envelope-from git) Date: Sat, 7 Oct 2023 00:32:11 GMT Message-Id: <202310070032.3970WBCE005671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4640df1b0a49 - main - mrsas: Fix callout locking in mrsas_complete_cmd() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4640df1b0a49697840b81f6bcd269a483514c6aa Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4640df1b0a49697840b81f6bcd269a483514c6aa commit 4640df1b0a49697840b81f6bcd269a483514c6aa Author: Mark Johnston AuthorDate: 2023-10-07 00:31:03 +0000 Commit: Mark Johnston CommitDate: 2023-10-07 00:31:03 +0000 mrsas: Fix callout locking in mrsas_complete_cmd() callout_stop() requires the associated lock to be held. This is a bit hacky, but I believe it's safe since the subsequent mrsas_cmd_done() call will also acquire the SIM lock to stop a different callout. PR: 265484 Reviewed by: imp Tested by: Jérémie Jourdin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39559 --- sys/dev/mrsas/mrsas.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 1241f44761c4..e362d4b455fc 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1732,11 +1732,13 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) data_length = r1_cmd->io_request->DataLength; sense = r1_cmd->sense; } + mtx_lock(&sc->sim_lock); r1_cmd->ccb_ptr = NULL; if (r1_cmd->callout_owner) { callout_stop(&r1_cmd->cm_callout); r1_cmd->callout_owner = false; } + mtx_unlock(&sc->sim_lock); mrsas_release_mpt_cmd(r1_cmd); mrsas_atomic_dec(&sc->fw_outstanding); mrsas_map_mpt_cmd_status(cmd_mpt, cmd_mpt->ccb_ptr, status,