Patch "ALSA: pcm: Check for null pointer of pointer substream before dereferencing it" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ALSA: pcm: Check for null pointer of pointer substream before dereferencing it

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-pcm-check-for-null-pointer-of-pointer-substream.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7278d05e016f1cf46d73780ccd76f0784723aa42
Author: Colin Ian King <colin.king@xxxxxxxxx>
Date:   Sun Apr 24 21:59:45 2022 +0100

    ALSA: pcm: Check for null pointer of pointer substream before dereferencing it
    
    [ Upstream commit 011b559be832194f992f73d6c0d5485f5925a10b ]
    
    Pointer substream is being dereferenced on the assignment of pointer card
    before substream is being null checked with the macro PCM_RUNTIME_CHECK.
    Although PCM_RUNTIME_CHECK calls BUG_ON, it still is useful to perform the
    the pointer check before card is assigned.
    
    Fixes: d4cfb30fce03 ("ALSA: pcm: Set per-card upper limit of PCM buffer allocations")
    Signed-off-by: Colin Ian King <colin.i.king@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220424205945.1372247-1-colin.i.king@xxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index f1fb856ff4ac..f1470590239e 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -446,7 +446,6 @@ 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))
@@ -455,6 +454,8 @@ 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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux