Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcfb7866 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: emu10k1: Avoid access to invalid pages when period=1



When period=1, the driver tries to allocate a bit bigger buffer than
requested by the user due to the irq latency tolerance.  This may lead
to accesses over the actually allocated pages.

This patch adds a check of the page index and assigns the silent page
when it's over the given buffer size.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c810f903
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -326,6 +326,9 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
	for (page = blk->first_page; page <= blk->last_page; page++, idx++) {
		unsigned long ofs = idx << PAGE_SHIFT;
		dma_addr_t addr;
		if (ofs >= runtime->dma_bytes)
			addr = emu->silent_page.addr;
		else
			addr = snd_pcm_sgbuf_get_addr(substream, ofs);
		if (! is_valid_page(emu, addr)) {
			printk(KERN_ERR "emu: failure page = %d\n", idx);