From nobody Sun Oct 15 13:16:21 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 4S7gjx6Wdfz4wwd7; Sun, 15 Oct 2023 13:16:21 +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 4S7gjx5lmqz3T3K; Sun, 15 Oct 2023 13:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697375781; 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=K3O6WXam/aHMYL8ZMCAwDAxG9odkmJnHx87c/ZnyJB4=; b=nKsktBGGJDqYZVeY8kziko7lYQymOae4t5ZrPDLg8WDgJJxKP8dQDxd7GO4S7IMqKXtNbj cRK8mF0fSCbp7gV7va4AN3CJtx5G0Gq814ouDf3T4SHfELlphPASVtvt5HAw+RlGJC00Sl L08pR7WdfGD/k4IDIB75Eb07i0i7ya0Ij8W0pfw15p1ojLOh/ddnZHtWleoQA1FsV+KyDA SQ0S+IGdedIdeZpXSX7I58dY0OlMnolSSfW/f0tEEXlCip9xrLHFRkhxpQ9rLA4+fdSQRq FvPDhE3ekAQfdeJtld/vxIDZ50cN2DgBt1HMD2Wc+NyPP7fdQbH02l8CKnB+9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697375781; a=rsa-sha256; cv=none; b=vomSJ0cl9cauNtgr6MKffcB/4xeGm1/z9F3PbctK3bFmvsULiBUZKVp1JtIe+elaKsAmwU f8p8ZnPbJgQyUA6ZdHhnBPXjHjifvrjWgxDVl/6cxLWzk0p22zzxzpuhaurJ6Nvoa11cmo kjL7tSbE9b0RunUoMYl16uT1y+r4X0t32wOOUCJigYOt4wByoAqonY6lSWwVka16x55M1J AfDhs3dM7WM2vt0d7DvA0xuUOYjgXd2tugmColrhaedW5xDkvO2LeVLdtcAvWTEvpIQtYA GOo+wvH7L2/EKGH0NHagkux9lwOekQBNhkqDoWW0i906MXY5MZnvTBTBo3zdiw== 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=1697375781; 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=K3O6WXam/aHMYL8ZMCAwDAxG9odkmJnHx87c/ZnyJB4=; b=lW6C33E5UJiGVMzZ2VmSxWFsGCY93TQatNhe0bUp8fVin7EjG/Gs79dTwCfWaedCm480x+ H7X0vJ4uSSDyIgEmnAJTzqTp0cyLGTmUjgYNS/MFAkzkblUyqwhtLKwbM1O2Nxp8sfywoS IvrhrS9iIicPpEMl9m95rAIp76ldqCiYa5US0wI4cEIEM25EaCfI9wIDib4xhmGsL/GpdJ tIjMCnN+kKvDuTOKxtLdIrqRIp6XB0loS1P+EJ4zJEyEw+4C+iABzNV28NGKsRHE6kAhKu s+WzovGsH5jwYIysaYwiSgssZqVxNF9z4dTtrd2SmAMlc7N/Qu9n91eJ0MYv8w== 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 4S7gjx4p8zz1CxB; Sun, 15 Oct 2023 13:16:21 +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 39FDGL3C059449; Sun, 15 Oct 2023 13:16:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39FDGLsa059446; Sun, 15 Oct 2023 13:16:21 GMT (envelope-from git) Date: Sun, 15 Oct 2023 13:16:21 GMT Message-Id: <202310151316.39FDGLsa059446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 630daf68d5bd - releng/14.0 - 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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 630daf68d5bd73136e981610449bf094ca00a4a3 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=630daf68d5bd73136e981610449bf094ca00a4a3 commit 630daf68d5bd73136e981610449bf094ca00a4a3 Author: Mark Johnston AuthorDate: 2023-10-07 00:31:03 +0000 Commit: Mark Johnston CommitDate: 2023-10-15 13:16:12 +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. Approved by: re (gjb) PR: 265484 Reviewed by: imp Tested by: Jérémie Jourdin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39559 (cherry picked from commit 4640df1b0a49697840b81f6bcd269a483514c6aa) (cherry picked from commit 29de7af6ee47a3a251763e4220203a0d960ea532) --- 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,