1. 09 Nov, 2023 2 commits
    • Takashi Iwai's avatar
      ALSA: info: Fix potential deadlock at disconnection · c7a60651
      Takashi Iwai authored
      As reported recently, ALSA core info helper may cause a deadlock at
      the forced device disconnection during the procfs operation.
      
      The proc_remove() (that is called from the snd_card_disconnect()
      helper) has a synchronization of the pending procfs accesses via
      wait_for_completion().  Meanwhile, ALSA procfs helper takes the global
      mutex_lock(&info_mutex) at both the proc_open callback and
      snd_card_info_disconnect() helper.  Since the proc_open can't finish
      due to the mutex lock, wait_for_completion() never returns, either,
      hence it deadlocks.
      
      	TASK#1				TASK#2
      	proc_reg_open()
      	  takes use_pde()
      	snd_info_text_entry_open()
      					snd_card_disconnect()
      					snd_info_card_disconnect()
      					  takes mutex_lock(&info_mutex)
      					proc_remove()
      					wait_for_completion(unused_pde)
      					  ... waiting task#1 closes
      	mutex_lock(&info_mutex)
      		=> DEADLOCK
      
      This patch is a workaround for avoiding the deadlock scenario above.
      
      The basic strategy is to move proc_remove() call outside the mutex
      lock.  proc_remove() can work gracefully without extra locking, and it
      can delete the tree recursively alone.  So, we call proc_remove() at
      snd_info_card_disconnection() at first, then delete the rest resources
      recursively within the info_mutex lock.
      
      After the change, the function snd_info_disconnect() doesn't do
      disconnection by itself any longer, but it merely clears the procfs
      pointer.  So rename the function to snd_info_clear_entries() for
      avoiding confusion.
      
      The similar change is applied to snd_info_free_entry(), too.  Since
      the proc_remove() is called only conditionally with the non-NULL
      entry->p, it's skipped after the snd_info_clear_entries() call.
      Reported-by: default avatarShinhyung Kang <s47.kang@samsung.com>
      Closes: https://lore.kernel.org/r/664457955.21699345385931.JavaMail.epsvc@epcpadp4Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231109141954.4283-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c7a60651
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v6.7-merge-window-2' of... · 3e3ab468
      Takashi Iwai authored
      Merge tag 'asoc-fix-v6.7-merge-window-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: One more fix for the merge window
      
      One additional driver fix that came in during the merge window.
      3e3ab468
  2. 08 Nov, 2023 3 commits
  3. 07 Nov, 2023 3 commits
  4. 06 Nov, 2023 2 commits
  5. 03 Nov, 2023 1 commit
  6. 01 Nov, 2023 5 commits
  7. 31 Oct, 2023 4 commits
  8. 30 Oct, 2023 4 commits
  9. 29 Oct, 2023 1 commit
  10. 27 Oct, 2023 15 commits