HomeFreeBSD

bhyve: Fix a buffer overread in the PCI hda device model.

Description

bhyve: Fix a buffer overread in the PCI hda device model.

The sc->codecs array contains HDA_CODEC_MAX (15) entries. The
guest-supplied cad field in the verb provided to hda_send_command is a
4-bit field that was used as an index into sc->codecs without any
bounds checking. The highest value (15) would overflow the array.

Other uses of sc->codecs in the device model used sc->codecs_no to
determine which array indices have been initialized, so use a similar
check to reject requests for uninitialized or invalid cad indices in
hda_send_command.

PR: 264582
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: corvink, markj, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38128

Details

Provenance
jhbAuthored on Jan 20 2023, 5:58 PM
Reviewer
corvink
Differential Revision
D38128: bhyve: Fix a buffer overread in the PCI hda device model.
Parents
rGbfe8e339eb77: bhyve: Fix a global buffer overread in the PCI hda device model.
Branches
Unknown
Tags
Unknown