Merge tag 'asoc-fix-v5.17-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git...
authorTakashi Iwai <tiwai@suse.de>
Tue, 1 Feb 2022 15:52:54 +0000 (16:52 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 1 Feb 2022 15:52:54 +0000 (16:52 +0100)
ASoC: Fixes for v5.17

Quite a few fixes here, including an unusually large set in the core
spurred on by various testing efforts as well as the usual small driver
fixes.  There are quite a few fixes for out of bounds writes in both the
core and the various Qualcomm drivers, plus a couple of fixes for
locking in the DPCM code.

1  2 
include/sound/pcm.h
include/uapi/sound/asound.h

diff --combined include/sound/pcm.h
@@@ -147,9 -147,6 +147,9 @@@ struct snd_pcm_ops 
  #define SNDRV_PCM_FMTBIT_S24_BE               _SNDRV_PCM_FMTBIT(S24_BE)
  #define SNDRV_PCM_FMTBIT_U24_LE               _SNDRV_PCM_FMTBIT(U24_LE)
  #define SNDRV_PCM_FMTBIT_U24_BE               _SNDRV_PCM_FMTBIT(U24_BE)
 +// For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
 +// available bit count in most significant bit. It's for the case of so-called 'left-justified' or
 +// `right-padding` sample which has less width than 32 bit.
  #define SNDRV_PCM_FMTBIT_S32_LE               _SNDRV_PCM_FMTBIT(S32_LE)
  #define SNDRV_PCM_FMTBIT_S32_BE               _SNDRV_PCM_FMTBIT(S32_BE)
  #define SNDRV_PCM_FMTBIT_U32_LE               _SNDRV_PCM_FMTBIT(U32_LE)
@@@ -617,6 -614,7 +617,7 @@@ void snd_pcm_stream_unlock(struct snd_p
  void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
  void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
  unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
+ unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);
  
  /**
   * snd_pcm_stream_lock_irqsave - Lock the PCM stream
  void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
                                      unsigned long flags);
  
+ /**
+  * snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
+  * @substream: PCM substream
+  * @flags: irq flags
+  *
+  * This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
+  * the single-depth lockdep subclass.
+  */
+ #define snd_pcm_stream_lock_irqsave_nested(substream, flags)          \
+       do {                                                            \
+               typecheck(unsigned long, flags);                        \
+               flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
+       } while (0)
  /**
   * snd_pcm_group_for_each_entry - iterate over the linked substreams
   * @s: the iterator
   *                                                                          *
   ****************************************************************************/
  
+ #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 */
@@@ -202,11 -204,6 +204,11 @@@ typedef int __bitwise snd_pcm_format_t
  #define       SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
  #define       SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
  #define       SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
 +/*
 + * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
 + * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
 + * `right-padding` sample which has less width than 32 bit.
 + */
  #define       SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
  #define       SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
  #define       SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)