ALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ context
diff mbox series

Message ID 20200113085719.26788-1-o-takashi@sakamocchi.jp
State New
Headers show
Series
  • ALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ context
Related show

Commit Message

Takashi Sakamoto Jan. 13, 2020, 8:57 a.m. UTC
ALSA firewire-tascam driver can bring corruption due to spin lock without
restoration of IRQ flag in SoftIRQ context. This commit fixes the bug.

Cc: Scott Bahling <sbahling@suse.com>
Cc: <stable@vger.kernel.org> # v4.21
Fixes: d7167422433c ("ALSA: firewire-tascam: queue events for change of control surface")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/tascam/amdtp-tascam.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Takashi Iwai Jan. 13, 2020, 9:41 a.m. UTC | #1
On Mon, 13 Jan 2020 09:57:19 +0100,
Takashi Sakamoto wrote:
> 
> ALSA firewire-tascam driver can bring corruption due to spin lock without
> restoration of IRQ flag in SoftIRQ context. This commit fixes the bug.
> 
> Cc: Scott Bahling <sbahling@suse.com>
> Cc: <stable@vger.kernel.org> # v4.21
> Fixes: d7167422433c ("ALSA: firewire-tascam: queue events for change of control surface")
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied, thanks.


Takashi

Patch
diff mbox series

diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c
index e80bb84c43f6..f823a2ab3544 100644
--- a/sound/firewire/tascam/amdtp-tascam.c
+++ b/sound/firewire/tascam/amdtp-tascam.c
@@ -157,14 +157,15 @@  static void read_status_messages(struct amdtp_stream *s,
 			if ((before ^ after) & mask) {
 				struct snd_firewire_tascam_change *entry =
 						&tscm->queue[tscm->push_pos];
+				unsigned long flag;
 
-				spin_lock_irq(&tscm->lock);
+				spin_lock_irqsave(&tscm->lock, flag);
 				entry->index = index;
 				entry->before = before;
 				entry->after = after;
 				if (++tscm->push_pos >= SND_TSCM_QUEUE_COUNT)
 					tscm->push_pos = 0;
-				spin_unlock_irq(&tscm->lock);
+				spin_unlock_irqrestore(&tscm->lock, flag);
 
 				wake_up(&tscm->hwdep_wait);
 			}