Page MenuHomeFreeBSD

mixer: Fix default_unit switching with mixers that have no devices
ClosedPublic

Authored by markj on Jan 15 2023, 2:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 7, 7:55 AM
Unknown Object (File)
Sun, Apr 5, 9:14 PM
Unknown Object (File)
Sat, Apr 4, 9:53 AM
Unknown Object (File)
Fri, Apr 3, 10:41 PM
Unknown Object (File)
Sat, Mar 14, 8:30 AM
Unknown Object (File)
Fri, Mar 13, 10:32 PM
Unknown Object (File)
Mar 10 2026, 6:11 AM
Unknown Object (File)
Feb 8 2026, 11:05 AM
Subscribers

Details

Summary

Apparently it's possible for a mixer to have no devices:

$ mixer -f /dev/mixer2
pcm2:mixer: <USB audio> at ? kld snd_uaudio (rec)

If this is the default sound device, an attempt to change the default
unit using mixer -d fails with a segfault because mod_dunit is called
with a NULL device pointer, which is dereferenced to get the parent
mixer.

ctl_dunit seems to be a dummy, i.e., we don't actually need it and can
simply pass the mixer to mod_dunit() directly. This patch removes that
structure and associated indirection to fix the crash.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable