Re: [PATCH] ALSA: sis7019: Don't shift the voice IRQ status by 32

From: Takashi Iwai

Date: Mon Nov 23 2026 - 04:00:14 EST


On Sun, 22 Nov 2026 11:08:16 +0100,
Suyuan Wang via B4 Relay wrote:
>
> From: Suyuan Wang <stevewong@xxxxxxxxxxx>
>
> sis_voice_irq() walks the set bits of a PISR_A or PISR_B status word:
>
> bit = __ffs(status);
> status >>= bit + 1;
>
> When voice 31 or 63 interrupts, bit is 31 and status is shifted by 32,
> which is undefined for a u32. On x86 the shift count is masked to 0, so
> status does not change, the loop never ends, and voice keeps moving 32
> entries forward on every pass, past the end of sis->voices[], with
> sis_update_voice() called on whatever is there. All of this runs in the
> hard IRQ handler. Voices are handed out from 0 up, so voice 31 is in use
> once enough playback streams are open.
>
> Walk the bits with for_each_set_bit() and index the voice by bit number
> instead. The voices are still updated in the same order.
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: 175859bf1602 ("[ALSA] sis7019: support the SiS 7019 Audio Accelerator")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
> Signed-off-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
> Signed-off-by: Suyuan Wang <stevewong@xxxxxxxxxxx>

As this doesn't look like an urgent issue (for a legacy old code), I
applied to for-next branch. Thanks.


Takashi