Skip to contentSkip to conversation

ALSA: seq: Fix KCSAN data-race warning at snd_seq_fifo_poll_wait()

PATCH New Takashi Iwai 1 participant 1 message Sep 17, 2025 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: seq: Fix KCSAN data-race warning at snd_seq_fifo_poll_wait()

snd_seq_fifo_poll_wait() evaluates f->cells without locking after poll_wait(), and KCSAN doesn't like it as it appears to be a data-race. Although this doesn't matter much in practice as the value is volatile, it's still better to address it for the mind piece.

Wrap it with f->lock spinlock for avoiding the potential data race.

---
 sound/core/seq/seq_fifo.c | 1 +
 1 file changed, 1 insertion(+)
sound/core/seq/seq_fifo.c +1 -0
index f23c6b7ae240..91cce1890111 100644
@@ -210,6 +210,7 @@ int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file,
 			   poll_table *wait)
 {
 	poll_wait(file, &f->input_sleep, wait);
+	guard(spinlock_irq)(&f->lock);
 	return (f->cells > 0);
 }
 
Signature · 1 line
2.50.1