From nobody Wed Jul 10 16:49:13 2024 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 4WK3jQ40jnz5Qmjn; Wed, 10 Jul 2024 16:49:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK3jP6zRWz4gZH; Wed, 10 Jul 2024 16:49:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720630154; 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=r7Vq/OM0tqEuLuCLUmqcVjNpMUcCPjaaSKyoCeJP9aM=; b=AcSGufBgTXLTdEA5CFp2mMLSy0RpVvgJw/56xUGh6bM/+J5fsnbXmPu8PybAN2zE0Qdddx SLUY00+o4vgHRm6H2iA/nBUmyyMwa3DRU+vL95UgzYJ2SCC1AG4upWkc1fPBFPKgrHpsYS Ju/nHy0npg826AQCpp4o6YiEiiNZf2MxmzbWAmjyb7R6deRzArlJWj9neoz7hYUfn3jV+4 xyd4Fr0OYyMPUaKoTOuPOCNuHrrbXcgIQAR4nHKDwiJfOVz5/psxpj32xnJiPDrN5KMROT thystFM4Dxg0Mc+jiXPs+UoWyX+2cnSp6bvgB3nDzfrPG5FDaD3KxKRR5EJNHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720630154; a=rsa-sha256; cv=none; b=iIl7ERVWWZoZfESJwxLe40aeyRKrbPdRo8JAQyiRRl4h1v0yf2j3a4SnH8hcZqPQzCq08e Q+U10u8a6qoHSKY8o0wyFMJExBNW+uhp+9EtnbQBqoCseY/PLs5zdZHKVMDmLl1Wnw9sRn WSOk3jW7R71kSJtVLdHqb8qV6hk3bUj7/TeyW2l7VsaB0UNE1z3LJlNq9EL+oJMH7tDyN+ eDNDECz2bB878wqbUW0uuVDg2h5ifDwqoJYx9dgYDw/BqmvRIyBrrwMIqfhA4+bGhS8hky d5KyCdT5ILh5NnBOK4lbtlHf95VmRu30x/RkKvtOwOWS04n0MUrED/DheZ+RmQ== 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=1720630154; 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=r7Vq/OM0tqEuLuCLUmqcVjNpMUcCPjaaSKyoCeJP9aM=; b=TDBkBk6Bjnbc5R4KvC3bx1bQOkWZhZjeWKaujXc476n1HZXTGMC1qTRSDDOXVcPr50iUM0 ph3WDTdS+PmbjUTbWYJb5od17r9hc7Ufw4lf4CK62gYZUFRJbpXtD0A83OaZDFO8bbqr9J js4i6NLlWyikryvoAfmKsfhqqpIQqMmeYcgSqBjvWiHePo0J/9r+4HnYx2MdRsCeOcg2tX Xg4jdTXS4vgS7wYj638oaaU6xFxZ6w5Y4C7UWiPMznrAWCjhIdKyKcDjxUanz5ACNE9HZu Hfw36hFoXi+fqEsAA2oAWp8ySnStKhMjLntSooqEBeebG0W2iqxQQmC21f1GyA== 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 4WK3jP6YmlzQ3P; Wed, 10 Jul 2024 16:49:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46AGnD9N035272; Wed, 10 Jul 2024 16:49:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46AGnDtN035269; Wed, 10 Jul 2024 16:49:13 GMT (envelope-from git) Date: Wed, 10 Jul 2024 16:49:13 GMT Message-Id: <202407101649.46AGnDtN035269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: fab137d23462 - stable/14 - sound: Add missing CHN_[UN]LOCKs in sndstat 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fab137d2346252f210417e9dee0ca190d5cbe198 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=fab137d2346252f210417e9dee0ca190d5cbe198 commit fab137d2346252f210417e9dee0ca190d5cbe198 Author: Christos Margiolis AuthorDate: 2024-07-06 18:23:22 +0000 Commit: Christos Margiolis CommitDate: 2024-07-10 16:48:13 +0000 sound: Add missing CHN_[UN]LOCKs in sndstat In sndstat_build_sound4_nvlist(), if we have INVARIANTS or SND_DIAGNOSTIC enabled, we will hit a lock assertion panic when we call CHN_GETVOLUME(). Also lock the channel in the sndstat_prepare_pcm() loop for good measure. Fixes: bbca3a75bb41 ("sound: Include sound(4) channel information in sndstat nvlist") Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45898 (cherry picked from commit e850bd36dfda98608432d2459800627d16119fec) --- sys/dev/sound/pcm/sndstat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 5b770810d19b..753531f3694e 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -456,6 +456,8 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) goto done; } + CHN_LOCK(c); + nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_NAME, c->name); nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_PARENTCHAN, c->parentchannel != NULL ? c->parentchannel->name : ""); @@ -537,6 +539,8 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) sbuf_printf(&sb, "%s]", (c->direction == PCMDIR_REC) ? "userland" : "hardware"); + CHN_UNLOCK(c); + sbuf_finish(&sb); nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_FEEDERCHAIN, sbuf_data(&sb)); @@ -1230,6 +1234,8 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose) KASSERT(c->bufhard != NULL && c->bufsoft != NULL, ("hosed pcm channel setup")); + CHN_LOCK(c); + sbuf_printf(s, "\n\t"); sbuf_printf(s, "%s[%s]: ", @@ -1321,6 +1327,8 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose) } sbuf_printf(s, "{%s}", (c->direction == PCMDIR_REC) ? "userland" : "hardware"); + + CHN_UNLOCK(c); } return (0);