Patch "ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()" has been added to the 4.14-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: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()

to the 4.14-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-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch
and it can be found in the queue-4.14 subdirectory.

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



commit 8520500a1d35c000ede5bdd57dabc3fd1125cba3
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Thu Oct 27 09:34:38 2022 +0800

    ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
    
    [ Upstream commit 4a4c8482e370d697738a78dcd7bf2780832cb712 ]
    
    dev_set_name() in soundbus_add_one() allocates memory for name, it need be
    freed when of_device_register() fails, call soundbus_dev_put() to give up
    the reference that hold in device_initialize(), so that it can be freed in
    kobject_cleanup() when the refcount hit to 0. And other resources are also
    freed in i2sbus_release_dev(), so it can return 0 directly.
    
    Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221027013438.991920-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index 000b58522106..c016df586992 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -302,6 +302,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
 
 	if (soundbus_add_one(&dev->sound)) {
 		printk(KERN_DEBUG "i2sbus: device registration error!\n");
+		if (dev->sound.ofdev.dev.kobj.state_initialized) {
+			soundbus_dev_put(&dev->sound);
+			return 0;
+		}
 		goto 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