1. 06 Dec, 2022 1 commit
    • Gaosheng Cui's avatar
      ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt · cf2ea3c8
      Gaosheng Cui authored
      I got a null-ptr-defer error report when I do the following tests
      on the qemu platform:
      
      make defconfig and CONFIG_PARPORT=m, CONFIG_PARPORT_PC=m,
      CONFIG_SND_MTS64=m
      
      Then making test scripts:
      cat>test_mod1.sh<<EOF
      modprobe snd-mts64
      modprobe snd-mts64
      EOF
      
      Executing the script, perhaps several times, we will get a null-ptr-defer
      report, as follow:
      
      syzkaller:~# ./test_mod.sh
      snd_mts64: probe of snd_mts64.0 failed with error -5
      modprobe: ERROR: could not insert 'snd_mts64': No such device
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor write access in kernel mode
       #PF: error_code(0x0002) - not-present page
       PGD 0 P4D 0
       Oops: 0002 [#1] PREEMPT SMP PTI
       CPU: 0 PID: 205 Comm: modprobe Not tainted 6.1.0-rc8-00588-g76dcd734 #6
       Call Trace:
        <IRQ>
        snd_mts64_interrupt+0x24/0xa0 [snd_mts64]
        parport_irq_handler+0x37/0x50 [parport]
        __handle_irq_event_percpu+0x39/0x190
        handle_irq_event_percpu+0xa/0x30
        handle_irq_event+0x2f/0x50
        handle_edge_irq+0x99/0x1b0
        __common_interrupt+0x5d/0x100
        common_interrupt+0xa0/0xc0
        </IRQ>
        <TASK>
        asm_common_interrupt+0x22/0x40
       RIP: 0010:_raw_write_unlock_irqrestore+0x11/0x30
        parport_claim+0xbd/0x230 [parport]
        snd_mts64_probe+0x14a/0x465 [snd_mts64]
        platform_probe+0x3f/0xa0
        really_probe+0x129/0x2c0
        __driver_probe_device+0x6d/0xc0
        driver_probe_device+0x1a/0xa0
        __device_attach_driver+0x7a/0xb0
        bus_for_each_drv+0x62/0xb0
        __device_attach+0xe4/0x180
        bus_probe_device+0x82/0xa0
        device_add+0x550/0x920
        platform_device_add+0x106/0x220
        snd_mts64_attach+0x2e/0x80 [snd_mts64]
        port_check+0x14/0x20 [parport]
        bus_for_each_dev+0x6e/0xc0
        __parport_register_driver+0x7c/0xb0 [parport]
        snd_mts64_module_init+0x31/0x1000 [snd_mts64]
        do_one_initcall+0x3c/0x1f0
        do_init_module+0x46/0x1c6
        load_module+0x1d8d/0x1e10
        __do_sys_finit_module+0xa2/0xf0
        do_syscall_64+0x37/0x90
        entry_SYSCALL_64_after_hwframe+0x63/0xcd
        </TASK>
       Kernel panic - not syncing: Fatal exception in interrupt
       Rebooting in 1 seconds..
      
      The mts wa not initialized during interrupt,  we add check for
      mts to fix this bug.
      
      Fixes: 68ab801e ("[ALSA] Add snd-mts64 driver for ESI Miditerminal 4140")
      Signed-off-by: default avatarGaosheng Cui <cuigaosheng1@huawei.com>
      Link: https://lore.kernel.org/r/20221206061004.1222966-1-cuigaosheng1@huawei.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cf2ea3c8
  2. 05 Dec, 2022 5 commits
  3. 01 Dec, 2022 7 commits
  4. 30 Nov, 2022 1 commit
    • Takashi Sakamoto's avatar
      ALSA: dice: add support for Focusrite Saffire Pro 40 with TCD3070 ASIC · 2133dc91
      Takashi Sakamoto authored
      TC Applied Technologies (TCAT) produces TCD3070 as final DICE ASIC for
      communication in IEEE 1394 bus for IEC 61883-1/6 protocol. As long as I
      know, latter model of Focusrite Saffire Pro 40 is an application of the
      ASIC and only in the market for consumers.
      
      This patchset adds support for the device. The device has several
      remarkable points.
      
      1. No support for extended synchronization information section in TCAT
      general protocol. The value of GLOBAL_EXTENDED_STATUS register is always
      zero. Additionally, NOTIFY_EXT_STATUS message is never emitted.
      
      2. No support for TCAT protocol extension. Hard coding is required for
      format of CIP payload.
      
      3. During several seconds after changing sampling rate, the block to
      process PCM frames is under disfunction. When starting packet streaming
      during the state, the block is never function till configuring different
      sampling rate and several seconds.
      
      This commit adds support for the device. The item 1 and 2 can be
      adaptable, while item 3 is not. It's not preferable that user process
      is forced to sleep during the disfunction in the call of ioctl(2) with
      SNDRV_PCM_IOCTL_HW_PARAMS or SNDRV_PCM_IOCTL_PREPARE request. It's
      inconvenient but let user configure preferable sampling rate in advance
      of starting PCM substream.
      
      The content of configuration ROM in the device I used is available at:
       * https://github.com/takaswie/am-config-roms/
      
      I note that any mixer control operation is implemented by unique
      transaction. The frame of request consists of 16 bytes header followed
      by payload.
      
      header (4 quadlets):
      1st: the type of request, prefixed with 0x8000
      2nd: counter at 2 bytes in MSB side, the length of data at 2 bytes in LSB
           side
      3rd: parameter 0
      4th: parameter 1
      
      payload (variable length if need):
      5th-: data according to parameters
      
      The request frame is sent by block write request to 0x'ffff'e040'01c0.
      
      The frame of response is similar to the frame of request, but it is
      header only, thus fixed to 16 bytes. The response frame is sent to the
      address which is registered by lock transaction to 0x'ffff'e040'0008.
      
      If the operation results in batch of data, the 2nd quadlet of header
      includes the length of data like request. The data is itself readable
      by read block request to 0x'ffff'e040'0030, which includes both
      header and payload for data, thus the length to read should be the
      length of data plus 16 bytes for header
      
      The actual value of request, parameter 0, parameter 1, and data is
      unclear yet.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20221130143313.43880-1-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2133dc91
  5. 29 Nov, 2022 3 commits
  6. 28 Nov, 2022 2 commits
  7. 25 Nov, 2022 1 commit
  8. 23 Nov, 2022 2 commits
  9. 19 Nov, 2022 4 commits
  10. 16 Nov, 2022 4 commits
    • Jaroslav Kysela's avatar
      selftests: alsa - add PCM test · aba51cd0
      Jaroslav Kysela authored
      This initial code does a simple sample transfer tests. By default,
      all PCM devices are detected and tested with short and long
      buffering parameters for 4 seconds. If the sample transfer timing
      is not in a +-100ms boundary, the test fails. Only the interleaved
      buffering scheme is supported in this version.
      
      The configuration may be modified with the configuration files.
      A specific hardware configuration is detected and activated
      using the sysfs regex matching. This allows to use the DMI string
      (/sys/class/dmi/id/* tree) or any other system parameters
      exposed in sysfs for the matching for the CI automation.
      
      The configuration file may also specify the PCM device list to detect
      the missing PCM devices.
      
      v1..v2:
        - added missing alsa-local.h header file
      
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
      Cc: Liam Girdwood <liam.r.girdwood@intel.com>
      Cc: Jesse Barnes <jsbarnes@google.com>
      Cc: Jimmy Cheng-Yi Chiang <cychiang@google.com>
      Cc: Curtis Malainey <cujomalainey@google.com>
      Cc: Brian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20221108115914.3751090-1-perex@perex.czSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      aba51cd0
    • Kuninori Morimoto's avatar
      ALSA: pcm: avoid nused-but-set-variable warning · 3827597a
      Kuninori Morimoto authored
      It will indicate below warning if W=1 was added and CONFIG_SND_DEBUG
      was not set. This patch adds __maybe_unused and avoid it.
      
      	${LINUX}/sound/core/pcm_native.c: In function 'constrain_mask_params':
      	${LINUX}/sound/core/pcm_native.c:291:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable]
      	  291 |         struct snd_mask old_mask;
      	      |                         ^~~~~~~~
      	${LINUX}/sound/core/pcm_native.c: In function 'constrain_interval_params':
      	${LINUX}/sound/core/pcm_native.c:327:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable]
      	  327 |         struct snd_interval old_interval;
      	      |                             ^~~~~~~~~~~~
      	${LINUX}/sound/core/pcm_native.c: In function 'constrain_params_by_rules':
      	${LINUX}/sound/core/pcm_native.c:368:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable]
      	  368 |         struct snd_interval old_interval;
      	      |                             ^~~~~~~~~~~~
      	${LINUX}/sound/core/pcm_native.c:367:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable]
      	  367 |         struct snd_mask old_mask;
      	      |                         ^~~~~~~~
      	${LINUX}/sound/core/pcm_native.c: In function 'snd_pcm_hw_params_choose':
      	${LINUX}/sound/core/pcm_native.c:652:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable]
      	  652 |         struct snd_interval old_interval;
      	      |                             ^~~~~~~~~~~~
      	${LINUX}/sound/core/pcm_native.c:651:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable]
      	  651 |         struct snd_mask old_mask;
      	      |                         ^~~~~~~~
      	cc1: all warnings being treated as errors
      	make[3]: *** [${LINUX}/scripts/Makefile.build:250: sound/core/pcm_native.o] error 1
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Tested-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/874juzg3kd.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3827597a
    • Takashi Iwai's avatar
      ALSA: memalloc: Allocate more contiguous pages for fallback case · cc265163
      Takashi Iwai authored
      Currently the fallback SG allocation tries to allocate each single
      page, and this tends to result in the reverse order of memory
      addresses when large space is available at boot, as the kernel takes a
      free page from the top to the bottom in the zone.  The end result
      looks as if non-contiguous (although it actually is).  What's worse is
      that it leads to an overflow of BDL entries for HD-audio.
      
      For avoiding such a problem, this patch modifies the allocation code
      slightly; now it tries to allocate the larger contiguous chunks as
      much as possible, then reduces to the smaller chunks only if the
      allocation failed -- a similar strategy as the existing
      snd_dma_alloc_pages_fallback() function.
      
      Along with the trick, drop the unused address array from
      snd_dma_sg_fallback object.  It was needed in the past when
      dma_alloc_coherent() was used, but with the standard page allocator,
      it became superfluous and never referred.
      
      Fixes: a8d302a0 ("ALSA: memalloc: Revive x86-specific WC page allocations again")
      Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
      Link: https://lore.kernel.org/r/20221114141658.29620-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cc265163
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · d69d137e
      Takashi Iwai authored
      Back-merge of devel branch for further fixes of memalloc helpers.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d69d137e
  11. 15 Nov, 2022 2 commits
  12. 12 Nov, 2022 3 commits
  13. 10 Nov, 2022 4 commits
  14. 09 Nov, 2022 1 commit