Skip to content
  1. Mar 29, 2023
    • Tasos Sahanidis's avatar
      ALSA: ymfpci: Create card with device-managed snd_devm_card_new() · f33fc157
      Tasos Sahanidis authored
      
      
      snd_card_ymfpci_remove() was removed in commit c6e6bb5e ("ALSA:
      ymfpci: Allocate resources with device-managed APIs"), but the call to
      snd_card_new() was not replaced with snd_devm_card_new().
      
      Since there was no longer a call to snd_card_free, unloading the module
      would eventually result in Oops:
      
      [697561.532887] BUG: unable to handle page fault for address: ffffffffc0924480
      [697561.532893] #PF: supervisor read access in kernel mode
      [697561.532896] #PF: error_code(0x0000) - not-present page
      [697561.532899] PGD ae1e15067 P4D ae1e15067 PUD ae1e17067 PMD 11a8f5067 PTE 0
      [697561.532905] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [697561.532909] CPU: 21 PID: 5080 Comm: wireplumber Tainted: G        W  OE      6.2.7 #1
      [697561.532914] Hardware name: System manufacturer System Product Name/TUF GAMING X570-PLUS, BIOS 4408 10/28/2022
      [697561.532916] RIP: 0010:try_module_get.part.0+0x1a/0xe0
      [697561.532924] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc bf 01 00 00 00 e8 56 3c f8 ff <41> 83 3c 24 02 0f 84 96 00 00 00 41 8b 84 24 30 03 00 00 85 c0 0f
      [697561.532927] RSP: 0018:ffffbe9b858c3bd8 EFLAGS: 00010246
      [697561.532930] RAX: ffff9815d14f1900 RBX: ffff9815c14e6000 RCX: 0000000000000000
      [697561.532933] RDX: 0000000000000000 RSI: ffffffffc055092c RDI: ffffffffb3778c1a
      [697561.532935] RBP: ffffbe9b858c3be8 R08: 0000000000000040 R09: ffff981a1a741380
      [697561.532937] R10: ffffbe9b858c3c80 R11: 00000009d56533a6 R12: ffffffffc0924480
      [697561.532939] R13: ffff9823439d8500 R14: 0000000000000025 R15: ffff9815cd109f80
      [697561.532942] FS:  00007f13084f1f80(0000) GS:ffff9824aef40000(0000) knlGS:0000000000000000
      [697561.532945] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [697561.532947] CR2: ffffffffc0924480 CR3: 0000000145344000 CR4: 0000000000350ee0
      [697561.532949] Call Trace:
      [697561.532951]  <TASK>
      [697561.532955]  try_module_get+0x13/0x30
      [697561.532960]  snd_ctl_open+0x61/0x1c0 [snd]
      [697561.532976]  snd_open+0xb4/0x1e0 [snd]
      [697561.532989]  chrdev_open+0xc7/0x240
      [697561.532995]  ? fsnotify_perm.part.0+0x6e/0x160
      [697561.533000]  ? __pfx_chrdev_open+0x10/0x10
      [697561.533005]  do_dentry_open+0x169/0x440
      [697561.533009]  vfs_open+0x2d/0x40
      [697561.533012]  path_openat+0xa9d/0x10d0
      [697561.533017]  ? debug_smp_processor_id+0x17/0x20
      [697561.533022]  ? trigger_load_balance+0x65/0x370
      [697561.533026]  do_filp_open+0xb2/0x160
      [697561.533032]  ? _raw_spin_unlock+0x19/0x40
      [697561.533036]  ? alloc_fd+0xa9/0x190
      [697561.533040]  do_sys_openat2+0x9f/0x160
      [697561.533044]  __x64_sys_openat+0x55/0x90
      [697561.533048]  do_syscall_64+0x3b/0x90
      [697561.533052]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      [697561.533056] RIP: 0033:0x7f1308a40db4
      [697561.533059] Code: 24 20 eb 8f 66 90 44 89 54 24 0c e8 46 68 f8 ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 78 68 f8 ff 8b 44
      [697561.533062] RSP: 002b:00007ffcce664450 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
      [697561.533066] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1308a40db4
      [697561.533068] RDX: 0000000000080000 RSI: 00007ffcce664690 RDI: 00000000ffffff9c
      [697561.533070] RBP: 00007ffcce664690 R08: 0000000000000000 R09: 0000000000000012
      [697561.533072] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000080000
      [697561.533074] R13: 00007f13054b069b R14: 0000565209f83200 R15: 0000000000000000
      [697561.533078]  </TASK>
      
      Fixes: c6e6bb5e ("ALSA: ymfpci: Allocate resources with device-managed APIs")
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Link: https://lore.kernel.org/r/20230329032422.170024-1-tasos@tasossah.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f33fc157
  2. Mar 24, 2023
  3. Mar 23, 2023
  4. Mar 21, 2023
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix recursive locking at XRUN during syncing · 8c721c53
      Takashi Iwai authored
      
      
      The recent support of low latency playback in USB-audio driver made
      the snd_usb_queue_pending_output_urbs() function to be called via PCM
      ack ops.  In the new code path, the function is performed already in
      the PCM stream lock.  The problem is that, when an XRUN is detected,
      the function calls snd_pcm_xrun() to notify, but snd_pcm_xrun() is
      supposed to be called only outside the stream lock.  As a result, it
      leads to a deadlock of PCM stream locking.
      
      For avoiding such a recursive locking, this patch adds an additional
      check to the code paths in PCM core that call the ack callback; now it
      checks the error code from the callback, and if it's -EPIPE, the XRUN
      is handled in the PCM core side gracefully.  Along with it, the
      USB-audio driver code is changed to follow that, i.e. -EPIPE is
      returned instead of the explicit snd_pcm_xrun() call when the function
      is performed already in the stream lock.
      
      Fixes: d5f871f8 ("ALSA: usb-audio: Improved lowlatency playback support")
      Reported-and-tested-by: default avatarJohn Keeping <john@metanate.com>
      Link: https://lore.kernel.org/r/20230317195128.3911155-1-john@metanate.com
      
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Reviewed-by; Takashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20230320142838.494-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8c721c53
    • Takashi Iwai's avatar
      ALSA: hda/conexant: Partial revert of a quirk for Lenovo · b871cb97
      Takashi Iwai authored
      
      
      The recent commit f83bb259 ("ALSA: hda/conexant: Add quirk for
      LENOVO 20149 Notebook model") introduced a quirk for the device with
      17aa:3977, but this caused a regression on another model (Lenovo
      Ideadpad U31) with the very same PCI SSID.  And, through skimming over
      the net, it seems that this PCI SSID is used for multiple different
      models, so it's no good idea to apply the quirk with the SSID.
      
      Although we may take a different ID check (e.g. the codec SSID instead
      of the PCI SSID), unfortunately, the original patch author couldn't
      identify the hardware details any longer as the machine was returned,
      and we can't develop the further proper fix.
      
      In this patch, instead, we partially revert the change so that the
      quirk won't be applied as default for addressing the regression.
      Meanwhile, the quirk function itself is kept, and it's now made to be
      applicable via the explicit model=lenovo-20149 option.
      
      Fixes: f83bb259 ("ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model")
      Reported-by: default avatarJetro Jormalainen <jje-lxkl@jetro.fi>
      Link: https://lore.kernel.org/r/20230308215009.4d3e58a6@mopti
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230320140954.31154-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b871cb97
  5. Mar 19, 2023
  6. Mar 15, 2023
    • Kuninori Morimoto's avatar
      ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() · 98e5eb11
      Kuninori Morimoto authored
      
      
      tuning_ctl_set() might have buffer overrun at (X) if it didn't break
      from loop by matching (A).
      
      	static int tuning_ctl_set(...)
      	{
      		for (i = 0; i < TUNING_CTLS_COUNT; i++)
      (A)			if (nid == ca0132_tuning_ctls[i].nid)
      				break;
      
      		snd_hda_power_up(...);
      (X)		dspio_set_param(..., ca0132_tuning_ctls[i].mid, ...);
      		snd_hda_power_down(...);                ^
      
      		return 1;
      	}
      
      We will get below error by cppcheck
      
      	sound/pci/hda/patch_ca0132.c:4229:2: note: After for loop, i has value 12
      	 for (i = 0; i < TUNING_CTLS_COUNT; i++)
      	 ^
      	sound/pci/hda/patch_ca0132.c:4234:43: note: Array index out of bounds
      	 dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20,
      	                                           ^
      This patch cares non match case.
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87sfe9eap7.wl-kuninori.morimoto.gx@renesas.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      98e5eb11
    • Kuninori Morimoto's avatar
      ALSA: asihpi: check pao in control_message() · 9026c0bf
      Kuninori Morimoto authored
      
      
      control_message() might be called with pao = NULL.
      Here indicates control_message() as sample.
      
      (B)	static void control_message(struct hpi_adapter_obj *pao, ...)
      	{                                                   ^^^
      		struct hpi_hw_obj *phw = pao->priv;
      		...                      ^^^
      	}
      
      (A)	void _HPI_6205(struct hpi_adapter_obj *pao, ...)
      	{                                      ^^^
      		...
      		case HPI_OBJ_CONTROL:
      (B)			control_message(pao, phm, phr);
      			break;          ^^^
      		...
      	}
      
      	void HPI_6205(...)
      	{
      		...
      (A)		_HPI_6205(NULL, phm, phr);
      		...       ^^^^
      	}
      
      Therefore, We will get too many warning via cppcheck, like below
      
      	sound/pci/asihpi/hpi6205.c:238:27: warning: Possible null pointer dereference: pao [nullPointer]
      		 struct hpi_hw_obj *phw = pao->priv;
      		                          ^
      	sound/pci/asihpi/hpi6205.c:433:13: note: Calling function '_HPI_6205', 1st argument 'NULL' value is 0
      		  _HPI_6205(NULL, phm, phr);
      		            ^
      	sound/pci/asihpi/hpi6205.c:401:20: note: Calling function 'control_message', 1st argument 'pao' value is 0
      	   control_message(pao, phm, phr);
      	                   ^
      Set phr->error like many functions doing, and don't call _HPI_6205()
      with NULL.
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87ttypeaqz.wl-kuninori.morimoto.gx@renesas.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9026c0bf
  7. Mar 10, 2023
  8. Mar 09, 2023
  9. Mar 08, 2023
  10. Mar 07, 2023
  11. Mar 06, 2023