From 3a3afa870ac1e56299f6dae2862c8c0abd74a9b3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 31 Aug 2023 13:44:32 +0000 Subject: [PATCH] Revert "ALSA: pcm: Check for null pointer of pointer substream before dereferencing it" This reverts commit b2421a196cb0911ea95aec1050a0b830464c8fa6 which is commit 011b559be832194f992f73d6c0d5485f5925a10b upstream. It breaks the Android abi. If it is required in the future, it can come back in an abi-safe way. Bug: 161946584 Change-Id: I4278870e1e9f98ba86e52d588d1b208a6b3255ba Signed-off-by: Greg Kroah-Hartman --- sound/core/pcm_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index b961a30c2a22..d360655e5deb 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -401,6 +401,7 @@ EXPORT_SYMBOL(snd_pcm_lib_malloc_pages); */ int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) { + struct snd_card *card = substream->pcm->card; struct snd_pcm_runtime *runtime; if (PCM_RUNTIME_CHECK(substream)) @@ -409,8 +410,6 @@ int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) if (runtime->dma_area == NULL) return 0; if (runtime->dma_buffer_p != &substream->dma_buffer) { - struct snd_card *card = substream->pcm->card; - /* it's a newly allocated buffer. release it now. */ do_free_pages(card, runtime->dma_buffer_p); kfree(runtime->dma_buffer_p);