Skip to content

Commit 06feec6

Browse files
digetxbroonie
authored andcommitted
ASoC: hdmi-codec: Fix OOB memory accesses
Correct size of iec_status array by changing it to the size of status array of the struct snd_aes_iec958. This fixes out-of-bounds slab read accesses made by memcpy() of the hdmi-codec driver. This problem is reported by KASAN. Cc: [email protected] Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent fb25621 commit 06feec6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/uapi/sound/asound.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
* *
5757
****************************************************************************/
5858

59+
#define AES_IEC958_STATUS_SIZE 24
60+
5961
struct snd_aes_iec958 {
60-
unsigned char status[24]; /* AES/IEC958 channel status bits */
62+
unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
6163
unsigned char subcode[147]; /* AES/IEC958 subcode bits */
6264
unsigned char pad; /* nothing */
6365
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */

sound/soc/codecs/hdmi-codec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct hdmi_codec_priv {
277277
bool busy;
278278
struct snd_soc_jack *jack;
279279
unsigned int jack_status;
280-
u8 iec_status[5];
280+
u8 iec_status[AES_IEC958_STATUS_SIZE];
281281
};
282282

283283
static const struct snd_soc_dapm_widget hdmi_widgets[] = {

0 commit comments

Comments
 (0)