]> Git Repo - linux.git/commitdiff
ASoC: hdmi-codec: Fix OOB memory accesses
authorDmitry Osipenko <[email protected]>
Wed, 12 Jan 2022 19:50:39 +0000 (22:50 +0300)
committerMark Brown <[email protected]>
Fri, 28 Jan 2022 15:59:19 +0000 (15:59 +0000)
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]>
include/uapi/sound/asound.h
sound/soc/codecs/hdmi-codec.c

index ff7e638221c539089413d792378ec3602f308d2e..228279ea0670cfd994f176925e4ffbfb2c233f43 100644 (file)
  *                                                                          *
  ****************************************************************************/
 
+#define AES_IEC958_STATUS_SIZE         24
+
 struct snd_aes_iec958 {
-       unsigned char status[24];       /* AES/IEC958 channel status bits */
+       unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
        unsigned char subcode[147];     /* AES/IEC958 subcode bits */
        unsigned char pad;              /* nothing */
        unsigned char dig_subframe[4];  /* AES/IEC958 subframe bits */
index b61f980cabdc0233e8b6265aecd683ad99420574..b07607a9ecea4e43c359da1ca124cce1f436dfd9 100644 (file)
@@ -277,7 +277,7 @@ struct hdmi_codec_priv {
        bool busy;
        struct snd_soc_jack *jack;
        unsigned int jack_status;
-       u8 iec_status[5];
+       u8 iec_status[AES_IEC958_STATUS_SIZE];
 };
 
 static const struct snd_soc_dapm_widget hdmi_widgets[] = {
This page took 0.056724 seconds and 4 git commands to generate.