Patch "ALSA: sb: Fix potential double-free of CSP mixer elements" has been added to the 5.13-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: sb: Fix potential double-free of CSP mixer elements

to the 5.13-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-sb-fix-potential-double-free-of-csp-mixer-eleme.patch
and it can be found in the queue-5.13 subdirectory.

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



commit 8442be789a958e2ff9302af8561645deb4975bc1
Author: Takashi Iwai <tiwai@xxxxxxx>
Date:   Tue Jun 8 16:04:37 2021 +0200

    ALSA: sb: Fix potential double-free of CSP mixer elements
    
    [ Upstream commit c305366a37441c2ac90b08711cb6f032b43672f2 ]
    
    snd_sb_qsound_destroy() contains the calls of removing the previously
    created mixer controls, but it doesn't clear the pointers.  As
    snd_sb_qsound_destroy() itself may be repeatedly called via ioctl,
    this could lead to double-free potentially.
    
    Fix it by clearing the struct fields properly afterwards.
    
    Link: https://lore.kernel.org/r/20210608140540.17885-4-tiwai@xxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 4789345a8fdd..c98ccd421a2e 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -1072,10 +1072,14 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p)
 	card = p->chip->card;	
 	
 	down_write(&card->controls_rwsem);
-	if (p->qsound_switch)
+	if (p->qsound_switch) {
 		snd_ctl_remove(card, p->qsound_switch);
-	if (p->qsound_space)
+		p->qsound_switch = NULL;
+	}
+	if (p->qsound_space) {
 		snd_ctl_remove(card, p->qsound_space);
+		p->qsound_space = NULL;
+	}
 	up_write(&card->controls_rwsem);
 
 	/* cancel pending transfer of QSound parameters */



[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