Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579717

[PATCH 4.4 19/20] ALSA: seq: Dont handle loop timeout at snd_seq_pool_done()

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 19/20] ALSA: seq: Dont handle loop timeout at snd_seq_pool_done()
Date 2017-02-13 14:10 +0100
Message-ID <taoyg-47y-65@gated-at.bofh.it> (permalink)
References <taoyd-47y-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 37a7ea4a9b81f6a864c10a7cb0b96458df5310a3 upstream.

snd_seq_pool_done() syncs with closing of all opened threads, but it
aborts the wait loop with a timeout, and proceeds to the release
resource even if not all threads have been closed.  The timeout was 5
seconds, and if you run a crazy stuff, it can exceed easily, and may
result in the access of the invalid memory address -- this is what
syzkaller detected in a bug report.

As a fix, let the code graduate from naiveness, simply remove the loop
timeout.

BugLink: http://lkml.kernel.org/r/CACT4Y+YdhDV2H5LLzDTJDVF-qiYHUHhtRaW4rbb4gUhTCQB81w@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/core/seq/seq_memory.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -419,7 +419,6 @@ int snd_seq_pool_done(struct snd_seq_poo
 {
 	unsigned long flags;
 	struct snd_seq_event_cell *ptr;
-	int max_count = 5 * HZ;
 
 	if (snd_BUG_ON(!pool))
 		return -EINVAL;
@@ -432,14 +431,8 @@ int snd_seq_pool_done(struct snd_seq_poo
 	if (waitqueue_active(&pool->output_sleep))
 		wake_up(&pool->output_sleep);
 
-	while (atomic_read(&pool->counter) > 0) {
-		if (max_count == 0) {
-			pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
-			break;
-		}
+	while (atomic_read(&pool->counter) > 0)
 		schedule_timeout_uninterruptible(1);
-		max_count--;
-	}
 	
 	/* release all resources */
 	spin_lock_irqsave(&pool->lock, flags);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/20] 4.4.49-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:10 +0100
  [PATCH 4.4 16/20] scsi: mpt3sas: disable ASPM for MPI2 controllers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:10 +0100
  [PATCH 4.4 13/20] [PATCH] netvsc: Set maximum GSO size in the right place Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:10 +0100
  [PATCH 4.4 01/20] ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:10 +0100
  [PATCH 4.4 19/20] ALSA: seq: Dont handle loop timeout at snd_seq_pool_done() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:10 +0100
  [PATCH 4.4 08/20] target: Use correct SCSI status during EXTENDED_COPY exception Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 12/20] mac80211: Fix adding of mesh vendor IEs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 17/20] xen-netfront: Delete rx_refill_timer in xennet_disconnect_backend() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 11/20] ARM: 8642/1: LPAE: catch pending imprecise abort on unmask Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 04/20] cpumask: use nr_cpumask_bits for parsing functions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 07/20] target: Dont BUG_ON during NodeACL dynamic -> explicit conversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 06/20] ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 02/20] selinux: fix off-by-one in setprocattr Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  [PATCH 4.4 09/20] target: Fix early transport_generic_handle_tmr abort scenario Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:20 +0100
  Re: [PATCH 4.4 00/20] 4.4.49-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-02-13 18:20 +0100
  Re: [PATCH 4.4 00/20] 4.4.49-stable review Guenter Roeck <linux@roeck-us.net> - 2017-02-13 21:10 +0100
  Re: [PATCH 4.4 00/20] 4.4.49-stable review Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2017-02-15 12:50 +0100
    Re: [PATCH 4.4 00/20] 4.4.49-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-15 17:40 +0100

csiph-web