Message ID | 20191208232226.6685-1-o-takashi@sakamocchi.jp (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | firewire-motu: fix double unlocked 'motu->mutex' | expand |
Oops. I forgot to add 'ALSA: ' prefix to the subject line. I'm sorry but would I request maintainers to add it when applying... On Mon, Dec 9, 2019, at 08:22, Takashi Sakamoto wrote: > Mutex is doubly unlocked in some error path of pcm.open. This commit fixes > ALSA firewire-motu driver in Linux kernel v5.5. > > Reported-by: kbuild test robot <lkp@intel.com> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Fixes: 3fd80b200388 ("ALSA: firewire-motu: use the same size of period > for PCM substream in AMDTP streams") > Fixes: 0f5482e7875b ("ALSA: firewire-motu: share PCM buffer size for > both direction") > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> > --- > sound/firewire/motu/motu-pcm.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c > index 349b4d09e84f..005970931030 100644 > --- a/sound/firewire/motu/motu-pcm.c > +++ b/sound/firewire/motu/motu-pcm.c > @@ -177,18 +177,14 @@ static int pcm_open(struct snd_pcm_substream *substream) > err = snd_pcm_hw_constraint_minmax(substream->runtime, > SNDRV_PCM_HW_PARAM_PERIOD_SIZE, > frames_per_period, frames_per_period); > - if (err < 0) { > - mutex_unlock(&motu->mutex); > + if (err < 0) > goto err_locked; > - } > > err = snd_pcm_hw_constraint_minmax(substream->runtime, > SNDRV_PCM_HW_PARAM_BUFFER_SIZE, > frames_per_buffer, frames_per_buffer); > - if (err < 0) { > - mutex_unlock(&motu->mutex); > + if (err < 0) > goto err_locked; > - } > } > } > > -- > 2.20.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel >
On Mon, 09 Dec 2019 03:51:24 +0100, Takashi Sakamoto wrote: > > Oops. I forgot to add 'ALSA: ' prefix to the subject line. I'm sorry but would I > request maintainers to add it when applying... Don't worry, applied it now with the correction. thanks, Takashi > > On Mon, Dec 9, 2019, at 08:22, Takashi Sakamoto wrote: > > Mutex is doubly unlocked in some error path of pcm.open. This commit fixes > > ALSA firewire-motu driver in Linux kernel v5.5. > > > > Reported-by: kbuild test robot <lkp@intel.com> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > > Fixes: 3fd80b200388 ("ALSA: firewire-motu: use the same size of period > > for PCM substream in AMDTP streams") > > Fixes: 0f5482e7875b ("ALSA: firewire-motu: share PCM buffer size for > > both direction") > > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> > > --- > > sound/firewire/motu/motu-pcm.c | 8 ++------ > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c > > index 349b4d09e84f..005970931030 100644 > > --- a/sound/firewire/motu/motu-pcm.c > > +++ b/sound/firewire/motu/motu-pcm.c > > @@ -177,18 +177,14 @@ static int pcm_open(struct snd_pcm_substream *substream) > > err = snd_pcm_hw_constraint_minmax(substream->runtime, > > SNDRV_PCM_HW_PARAM_PERIOD_SIZE, > > frames_per_period, frames_per_period); > > - if (err < 0) { > > - mutex_unlock(&motu->mutex); > > + if (err < 0) > > goto err_locked; > > - } > > > > err = snd_pcm_hw_constraint_minmax(substream->runtime, > > SNDRV_PCM_HW_PARAM_BUFFER_SIZE, > > frames_per_buffer, frames_per_buffer); > > - if (err < 0) { > > - mutex_unlock(&motu->mutex); > > + if (err < 0) > > goto err_locked; > > - } > > } > > } > > > > -- > > 2.20.1 > > > > _______________________________________________ > > Alsa-devel mailing list > > Alsa-devel@alsa-project.org > > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel > > >
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c index 349b4d09e84f..005970931030 100644 --- a/sound/firewire/motu/motu-pcm.c +++ b/sound/firewire/motu/motu-pcm.c @@ -177,18 +177,14 @@ static int pcm_open(struct snd_pcm_substream *substream) err = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, frames_per_period, frames_per_period); - if (err < 0) { - mutex_unlock(&motu->mutex); + if (err < 0) goto err_locked; - } err = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, frames_per_buffer, frames_per_buffer); - if (err < 0) { - mutex_unlock(&motu->mutex); + if (err < 0) goto err_locked; - } } }
Mutex is doubly unlocked in some error path of pcm.open. This commit fixes ALSA firewire-motu driver in Linux kernel v5.5. Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 3fd80b200388 ("ALSA: firewire-motu: use the same size of period for PCM substream in AMDTP streams") Fixes: 0f5482e7875b ("ALSA: firewire-motu: share PCM buffer size for both direction") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> --- sound/firewire/motu/motu-pcm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)