Patch "ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()" has been added to the 4.9-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: ac97: fix possible memory leak in snd_ac97_dev_register()

to the 4.9-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-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch
and it can be found in the queue-4.9 subdirectory.

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



commit 94ca3d2c015e7fda3f373b047d0ae522ebdfc9e2
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Wed Oct 19 17:30:25 2022 +0800

    ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
    
    [ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]
    
    If device_register() fails in snd_ac97_dev_register(), it should
    call put_device() to give up reference, or the name allocated in
    dev_set_name() is leaked.
    
    Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a7f1e4ef3f88..4a420f4303a7 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1965,6 +1965,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
 		     snd_ac97_get_short_name(ac97));
 	if ((err = device_register(&ac97->dev)) < 0) {
 		ac97_err(ac97, "Can't register ac97 bus\n");
+		put_device(&ac97->dev);
 		ac97->dev.bus = NULL;
 		return err;
 	}



[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