Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2025 09:27:47 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 123881aead72 - stable/14 - sound: Honor CHN_F_NBIO
Message-ID:  <202509170927.58H9Rli2064842@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=123881aead724fefa38d4324d2d442ecc79942b2

commit 123881aead724fefa38d4324d2d442ecc79942b2
Author:     Damjan Jovanovic <damjan.jov@gmail.com>
AuthorDate: 2025-09-15 17:42:41 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-09-17 09:27:42 +0000

    sound: Honor CHN_F_NBIO
    
    If the device is opened with O_NONBLOCK, even though we check for it in
    order to set CHN_F_NBIO, the subsequent chn_reset() calls will clear all
    flags, except those set in CHN_F_RESET, which does not include
    CHN_F_NBIO.
    
    Add CHN_F_NBIO to CHN_F_RESET. Additionally, because primary channels
    can be reused, make sure we do not unintentionally keep CHN_F_NBIO set
    if the channel is re-opened, but without O_NONBLOCK.
    
    PR:             289441
    MFC after:      2 days
    Reviewed by:    christos, markj
    Differential Revision:  https://reviews.freebsd.org/D52493
    
    (cherry picked from commit e8b5025c3880b04c1c2139fe73b65fbd6deb41d4)
---
 sys/dev/sound/pcm/channel.h | 2 +-
 sys/dev/sound/pcm/dsp.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h
index fab182b22774..9ad21d219001 100644
--- a/sys/dev/sound/pcm/channel.h
+++ b/sys/dev/sound/pcm/channel.h
@@ -408,7 +408,7 @@ enum {
 
 #define CHN_F_RESET		(CHN_F_BUSY | CHN_F_DEAD |		\
 				 CHN_F_VIRTUAL | CHN_F_HAS_VCHAN |	\
-				 CHN_F_VCHAN_DYNAMIC |			\
+				 CHN_F_VCHAN_DYNAMIC | CHN_F_NBIO |	\
 				 CHN_F_PASSTHROUGH | CHN_F_EXCLUSIVE)
 
 #define CHN_F_MMAP_INVALID	(CHN_F_DEAD | CHN_F_RUNNING)
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index aa6ad4a59778..da38f52021ae 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -299,7 +299,7 @@ dsp_close(void *data)
 			CHN_LOCK(rdch);
 			chn_abort(rdch); /* won't sleep */
 			rdch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP |
-			    CHN_F_DEAD | CHN_F_EXCLUSIVE);
+			    CHN_F_DEAD | CHN_F_EXCLUSIVE | CHN_F_NBIO);
 			chn_reset(rdch, 0, 0);
 			chn_release(rdch);
 			if (rdch->flags & CHN_F_VIRTUAL) {
@@ -323,7 +323,7 @@ dsp_close(void *data)
 			CHN_LOCK(wrch);
 			chn_flush(wrch); /* may sleep */
 			wrch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP |
-			    CHN_F_DEAD | CHN_F_EXCLUSIVE);
+			    CHN_F_DEAD | CHN_F_EXCLUSIVE | CHN_F_NBIO);
 			chn_reset(wrch, 0, 0);
 			chn_release(wrch);
 			if (wrch->flags & CHN_F_VIRTUAL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509170927.58H9Rli2064842>