Skip to content

Commit

Permalink
ALSA: timer: Fix the breakage of slave link open
Browse files Browse the repository at this point in the history
A silly mistake was made while applying the fix for potential races in
commit 6a34367 ("ALSA: timer: Fix possible race at assigning a
timer instance"): when a slave PCM is opened and succeeds, it doesn't
return but proceeds to the master timer open code instead.  Plug the
hole and beautify a bit.

Fixes: 6a34367 ("ALSA: timer: Fix possible race at assigning a timer instance")
Reported-by: syzbot+4476917c053f60112c99@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20191111173642.6093-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 11, 2019
1 parent 2bc1e1f commit 0c4f09c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/core/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ int snd_timer_open(struct snd_timer_instance *timeri,
list_add_tail(&timeri->open_list, &snd_timer_slave_list);
num_slaves++;
err = snd_timer_check_slave(timeri);
if (err < 0)
goto close;
goto list_added;
}

/* open a master instance */
Expand Down Expand Up @@ -324,7 +323,7 @@ int snd_timer_open(struct snd_timer_instance *timeri,
list_add_tail(&timeri->open_list, &timer->open_list_head);
timer->num_instances++;
err = snd_timer_check_master(timeri);
close:
list_added:
if (err < 0)
snd_timer_close_locked(timeri, &card_dev_to_put);

Expand Down

0 comments on commit 0c4f09c

Please sign in to comment.