From nobody Sat Oct 14 15:29:00 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 4S76jS3yNnz4wts9; Sat, 14 Oct 2023 15:29: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 4S76jS3PRLz4FL7; Sat, 14 Oct 2023 15:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697297340; 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=iRv9zyoR6HiAhfuGzBsp7XRwpS97pxAEP0ameDvPhLk=; b=RLtXJDdT/lFkHdI8/rGAVOpuj9xCsQdBHdmCDH+NmrZvabvIH9yexoJIHHmnkymyvtsie8 l7m+B7MBCnmBppz3BnlFtKOo6ZP+oJGj/h4a3/nB5DKDapA+zKuokZpp6kaLwD6AqBSKuQ xOSSXJrLsmIcJ2BbYOpwrlDm1z5NhlFPi/guGRHaXqcD07qiDNexT+fxuJoEacYeFS3p0Z zCaxa6ktXqSJMsoMZnrD2mCh+bQ3IU6zUYMPz0N3DDEyzaTaLhBtfOf/HjJzydFXyS3nH4 94pUgOUGOotnOL++Kr34W6Y/3CHH8iJqsKwvU/zC+EwLVVrTEMVbO2X3RKjpoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697297340; a=rsa-sha256; cv=none; b=fNAMKmqHY/6NyBk3IEPpUQf+MZ0QdY7LdL40x1cluIAoxBNAlAQA3GiKvbaFC5s8VWY5jY vH0OQc3XOIYwpgc5BMC1FVv9K40VHtmE5mLSVDDt4Hx0GLTQWOUcJUwNwy+glidhhnuKzQ kZJhCr8Z8BEz3Fqj2VJaDtk5n67MiytqFeJe7RDJENtmCKS8zarl82IncMv/YIdXaAhiYk 3lLqEHlPXO7/cBpdBZSceymV0SxaOsyzdNH/X9UIMtlHtEXrsPY0PmM6UnSgydyYMm1Nt0 hU9Cp1PX3Vkaf10raLUD0m0maWwmos/QYSG5LbSPGaz5G7mlX0yrfAvbtMCHtQ== 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=1697297340; 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=iRv9zyoR6HiAhfuGzBsp7XRwpS97pxAEP0ameDvPhLk=; b=UNIkEquxnYg1S0mIR29j7u/wSb00hXsb0v1dyFAmyQN65iaUqKUbRy/JPFHidlrFnzVmEl X8Rha9UemP+lea9oK2jEsl+E0Rz67n4kdUyI2cO7i96XiFBOfltlZQl2yUSAqe7lECcznw jXvt6xLbs8Bmfv9e3En4IDdZdsXn08Ctv03xBYSAp0w7UY7nd3ZPN5CcPdEPh+TYPRtoYB 2kl9Tj/6xEz01Jo8GMoCFjm9LMGXZlXR7lZiHS7VzjSHw9ozwaLjHnDsJbCV5kgi6p3fz4 aUOe7wOC8+Xq+bXN6Lpec8lV5Eb3+NoTU/q/xuWh6sCWvyzfJorML2hxOqX/kg== 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 4S76jS2Sf4zbnW; Sat, 14 Oct 2023 15:29: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 39EFT0ut080159; Sat, 14 Oct 2023 15:29:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39EFT05a080156; Sat, 14 Oct 2023 15:29:00 GMT (envelope-from git) Date: Sat, 14 Oct 2023 15:29:00 GMT Message-Id: <202310141529.39EFT05a080156@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: 1b934004c04c - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b934004c04c64e96ed08b1a0c560225def21d94 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1b934004c04c64e96ed08b1a0c560225def21d94 commit 1b934004c04c64e96ed08b1a0c560225def21d94 Author: Mark Johnston AuthorDate: 2023-10-07 00:31:03 +0000 Commit: Mark Johnston CommitDate: 2023-10-14 15:28:48 +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 (cherry picked from commit 4640df1b0a49697840b81f6bcd269a483514c6aa) --- 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 908cb19aaf3f..9689dbec4417 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1753,11 +1753,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,