Skip to contentSkip to conversation

ASoC at91 - Fix NULL pointer dereference in at91_i2s_shutdown

PATCH Applied Frank Mandarino 2 participants 2 messages Dec 29, 2006 – Jan 8, 2007 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC at91 - Fix NULL pointer dereference in at91_i2s_shutdown

This patch fixes a NULL pointer exception which occurs when a substream is opened and immediately closed.

Signature · 3 lines
Frank Mandarino                                fmandarino(a)endrelia.com
Endrelia Technologies Inc.
Toronto, Ontario, Canada

# HG changeset patch
# User fam@procyon
# Date 1167417628 18000
# Node ID db7345e709ceb94df2cce3ea8ea7d32cc83d789e # Parent 4eae1a19406e9e14c38efdef7fb1bd603200485d ASoC at91 - Fix NULL pointer dereference in at91_i2s_shutdown

at91_i2s_shutdown() depends on the snd_soc_cpu_dai dma_data field being NULL if the substream's DMA parameters were not set up.

However, if a substream was started, then shutdown before the DMA parameters were setup, the dma_data field would still contain the value that was set for a previous substream, which pointed to an invalid at91_pcm_dma_params structure.

The fix is to initialize the dma_data field to NULL when the substream is started.

soc/at91/at91-i2s.c +7 -0
diff -r 4eae1a19406e -r db7345e709ce soc/at91/at91-i2s.c
@@ -295,6 +295,13 @@ static int at91_i2s_startup(struct snd_p
 	}
 	ssc_p->dir_mask |= dir_mask;
 	spin_unlock_irq(&ssc_p->lock);
+
+	/*
+	 * dma_data is not set until hw_params() is called and
+	 * shutdown() depends on this value being NULL if hw_params()
+	 * was not called.
+	 */
+	rtd->cpu_dai->dma_data = NULL;
 
 	return 0;
 }

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Applied
#1 lore raw

At Fri, 29 Dec 2006 13:52:27 -0500,

Quoted 6 lines · Frank Mandarino

This patch fixes a NULL pointer exception which occurs when a substream is opened and immediately closed.

Applied to ALSA HG tree. Thanks.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV