git: 0d33cdd04da7 - stable/15 - sound: Unlock around uiomove() in midi_{read,write}()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Jan 2026 16:07:16 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=0d33cdd04da7498a2070fe3f1557b2d519cc66fb
commit 0d33cdd04da7498a2070fe3f1557b2d519cc66fb
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-01-12 11:27:15 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-01-21 16:05:31 +0000
sound: Unlock around uiomove() in midi_{read,write}()
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54130
(cherry picked from commit 6b69d6726a7d3455fb295abfcf9aedd48c580d4a)
---
sys/dev/sound/midi/midi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index c86f5fb41b14..8c38b00f15ad 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -391,9 +391,11 @@ midi_read(struct cdev *i_dev, struct uio *uio, int ioflag)
used = MIN(used, MIDI_RSIZE);
MIDIQ_DEQ(m->inq, buf, used);
+ mtx_unlock(&m->lock);
retval = uiomove(buf, used, uio);
if (retval)
- goto err1;
+ goto err0;
+ mtx_lock(&m->lock);
}
/*
@@ -457,9 +459,11 @@ midi_write(struct cdev *i_dev, struct uio *uio, int ioflag)
used = MIN(MIDIQ_AVAIL(m->outq), uio->uio_resid);
used = MIN(used, MIDI_WSIZE);
+ mtx_unlock(&m->lock);
retval = uiomove(buf, used, uio);
if (retval)
- goto err1;
+ goto err0;
+ mtx_lock(&m->lock);
MIDIQ_ENQ(m->outq, buf, used);
/*
* Inform the bottom half that data can be written