[alsa-devel] [PATCH 0/6] ALSA: firewire: fix wrong reference count for stream functionality at error path of rawmidi interface
Hi,
All of drivers in ALSA firewire stack maintain packet streaming by reference count. However at error path of MIDI interface, some drivers have a bug that the count remains at error path of rawmidi interface. This causes the drivers don't stop packet streaming even if it's not required.
This patchset fixes drivers including the bug.
Takashi Sakamoto (6): ALSA: bebob: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: fireworks: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: oxfw: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: dice: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: firewire-digi00x: fix wrong reference count for stream functionality at error path of rawmidi interface firewire-motu: fix wrong reference count for stream functionality at error path of rawmidi interface
sound/firewire/bebob/bebob_midi.c | 2 ++ sound/firewire/dice/dice-midi.c | 2 ++ sound/firewire/digi00x/digi00x-midi.c | 2 ++ sound/firewire/fireworks/fireworks_midi.c | 2 ++ sound/firewire/motu/motu-midi.c | 2 ++ sound/firewire/oxfw/oxfw-midi.c | 2 ++ 6 files changed, 12 insertions(+)
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA bebob driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: ac2888b958f2 ("ALSA: bebob: configure sampling transfer frequency in pcm.hw_params callback") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/bebob/bebob_midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c index f7db1f7bce86..f903271e93d0 100644 --- a/sound/firewire/bebob/bebob_midi.c +++ b/sound/firewire/bebob/bebob_midi.c @@ -22,6 +22,8 @@ static int midi_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++bebob->substreams_counter; err = snd_bebob_stream_start_duplex(bebob); + if (err < 0) + --bebob->substreams_counter; } mutex_unlock(&bebob->mutex); if (err < 0)
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA fireworks driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: 3d7250667ea9 ("ALSA: fireworks: configure sampling transfer frequency in pcm.hw_params callback") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/fireworks/fireworks_midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/fireworks/fireworks_midi.c b/sound/firewire/fireworks/fireworks_midi.c index 6d3d942e2dce..fd17777981e4 100644 --- a/sound/firewire/fireworks/fireworks_midi.c +++ b/sound/firewire/fireworks/fireworks_midi.c @@ -22,6 +22,8 @@ static int midi_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++efw->substreams_counter; err = snd_efw_stream_start_duplex(efw); + if (err < 0) + --efw->substreams_counter; } mutex_unlock(&efw->mutex); if (err < 0)
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA oxfw driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: 4f380d007052 ("ALSA: oxfw: configure packet format in pcm.hw_params callback") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/oxfw/oxfw-midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/oxfw/oxfw-midi.c b/sound/firewire/oxfw/oxfw-midi.c index 9ba62778add2..92538ab06932 100644 --- a/sound/firewire/oxfw/oxfw-midi.c +++ b/sound/firewire/oxfw/oxfw-midi.c @@ -23,6 +23,8 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++oxfw->substreams_count; err = snd_oxfw_stream_start_duplex(oxfw); + if (err < 0) + --oxfw->substreams_count; }
mutex_unlock(&oxfw->mutex);
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA dice driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: 3cd2c2d780a2 ("ALSA: dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/dice/dice-midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/dice/dice-midi.c b/sound/firewire/dice/dice-midi.c index 436f0c3c0fbb..30a0b8200160 100644 --- a/sound/firewire/dice/dice-midi.c +++ b/sound/firewire/dice/dice-midi.c @@ -22,6 +22,8 @@ static int midi_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++dice->substreams_counter; err = snd_dice_stream_start_duplex(dice); + if (err < 0) + --dice->substreams_counter; }
mutex_unlock(&dice->mutex);
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA firewire-digi00x driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: ae8ffbb26512 ("ALSA: firewire-digi00x: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/digi00x/digi00x-midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/digi00x/digi00x-midi.c b/sound/firewire/digi00x/digi00x-midi.c index ca06ad318ed6..0563701141b8 100644 --- a/sound/firewire/digi00x/digi00x-midi.c +++ b/sound/firewire/digi00x/digi00x-midi.c @@ -22,6 +22,8 @@ static int midi_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++dg00x->substreams_counter; err = snd_dg00x_stream_start_duplex(dg00x); + if (err < 0) + --dg00x->substreams_counter; } mutex_unlock(&dg00x->mutex); if (err < 0)
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming.
ALSA firewire-motu driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count.
This commit fixes the bug.
Fixes: 8edc56ec8f14 ("ALSA: firewire-motu: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/motu/motu-midi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/firewire/motu/motu-midi.c b/sound/firewire/motu/motu-midi.c index 4520c0060b83..5c77e417c627 100644 --- a/sound/firewire/motu/motu-midi.c +++ b/sound/firewire/motu/motu-midi.c @@ -22,6 +22,8 @@ static int midi_open(struct snd_rawmidi_substream *substream) if (err >= 0) { ++motu->substreams_counter; err = snd_motu_stream_start_duplex(motu); + if (err < 0) + --motu->substreams_counter; }
mutex_unlock(&motu->mutex);
On Sun, 07 Jul 2019 07:20:05 +0200, Takashi Sakamoto wrote:
Hi,
All of drivers in ALSA firewire stack maintain packet streaming by reference count. However at error path of MIDI interface, some drivers have a bug that the count remains at error path of rawmidi interface. This causes the drivers don't stop packet streaming even if it's not required.
This patchset fixes drivers including the bug.
Takashi Sakamoto (6): ALSA: bebob: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: fireworks: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: oxfw: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: dice: fix wrong reference count for stream functionality at error path of rawmidi interface ALSA: firewire-digi00x: fix wrong reference count for stream functionality at error path of rawmidi interface firewire-motu: fix wrong reference count for stream functionality at error path of rawmidi interface
Applied all six patches now. Thanks.
Takashi
participants (2)
-
Takashi Iwai
-
Takashi Sakamoto