diff options
| author | Akhil Arul <akhilarul324@gmail.com> | 2026-09-20 18:36:20 +0530 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-09-28 14:34:55 +0200 |
| commit | eb8a4dd45471b19db4862af91455a187ebd8c426 (patch) | |
| tree | 5193d99dfa6afeb9d21c5c512ecf12762a2f5385 /tools/lib/python/feat/parse_features.py | |
| parent | 33be70ba410598f71996bdd061194ae039a28eca (diff) | |
ALSA: rawmidi: give up draining output when the device stops draining
snd_rawmidi_drain_output() waits up to 10 seconds for the output buffer
to empty. The wait is unconditional, so a substream that has stopped
being consumed costs the full timeout on every call.
The sequencer OSS emulation makes that expensive. midisynth_unuse() runs
as the port unuse callback with grp->list_mutex held for write, and calls
snd_rawmidi_drain_output(). A single teardown closes every OSS midi port
of the device, so an unresponsive device exposing many ports holds the
rwsem for minutes. snd_seq_port_connect() needs the same rwsem, and in
the OSS path it runs under register_mutex, so every other odev_open()
queues up behind it until the hung task detector fires:
INFO: task syz.4.21:6176 blocked for more than 143 seconds.
__mutex_lock
odev_open
chrdev_open
vfs_open
path_openat
Detect a stalled drain by sampling the free space instead of always
sleeping for the whole timeout, and give up once it has not increased for
a second. A substream that is still making progress is given as long as
it needs, within the same overall 10 second limit as before, and each
wait is clipped to the remaining time so that limit is not overshot.
The warning is rate limited because a stalled drain is now detected much
more often than once per 10 seconds.
Closing one such device in qemu, with the syzkaller reproducer supplying
the gadget, took 72-103 seconds before and 9-11 seconds after.
Reported-by: syzbot+825b7e3a03dd072c187f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=825b7e3a03dd072c187f
Signed-off-by: Akhil Arul <akhilarul324@gmail.com>
Link: https://patch.msgid.link/20260920130620.61431-1-akhilarul324@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'tools/lib/python/feat/parse_features.py')
0 files changed, 0 insertions, 0 deletions
