Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Mandarino <fmandarino@endrelia.com>
To: alsa-devel@lists.sourceforge.net
Subject: [PATCH] ASoC at91 - Fix NULL pointer dereference in at91_i2s_shutdown
Date: Fri, 29 Dec 2006 13:52:27 -0500	[thread overview]
Message-ID: <459563EB.1050304@endrelia.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

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

Signed-off-by: Frank Mandarino <fmandarino@endrelia.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>

-- 
Frank Mandarino                                fmandarino(a)endrelia.com
Endrelia Technologies Inc.
Toronto, Ontario, Canada

[-- Attachment #2: asoc-at91-i2s-nullptr.patch --]
[-- Type: text/plain, Size: 1305 bytes --]

# 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.

Signed-off-by: Frank Mandarino <fmandarino@endrelia.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>

diff -r 4eae1a19406e -r db7345e709ce soc/at91/at91-i2s.c
--- a/soc/at91/at91-i2s.c	Thu Dec 28 13:56:48 2006 +0100
+++ b/soc/at91/at91-i2s.c	Fri Dec 29 13:40:28 2006 -0500
@@ -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;
 }

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

             reply	other threads:[~2006-12-29 18:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-29 18:52 Frank Mandarino [this message]
2007-01-08 11:17 ` [PATCH] ASoC at91 - Fix NULL pointer dereference in at91_i2s_shutdown Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=459563EB.1050304@endrelia.com \
    --to=fmandarino@endrelia.com \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox