Skip to content

Commit

Permalink
staging: greybus: Add missing rwsem around snd_ctl_remove() calls
Browse files Browse the repository at this point in the history
snd_ctl_remove() has to be called with card->controls_rwsem held (when
called after the card instantiation).  This patch adds the missing
rwsem calls around it.

Fixes: 510e340 ("staging: greybus: audio: Add helper APIs for dynamic audio modules")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20211116072027.18466-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Takashi Iwai authored and Greg Kroah-Hartman committed Nov 17, 2021
1 parent 47ac6f5 commit ffcf7ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/staging/greybus/audio_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ int gbaudio_remove_component_controls(struct snd_soc_component *component,
unsigned int num_controls)
{
struct snd_card *card = component->card->snd_card;
int err;

return gbaudio_remove_controls(card, component->dev, controls,
num_controls, component->name_prefix);
down_write(&card->controls_rwsem);
err = gbaudio_remove_controls(card, component->dev, controls,
num_controls, component->name_prefix);
up_write(&card->controls_rwsem);
return err;
}

0 comments on commit ffcf7ae

Please sign in to comment.