ALSA: hda - Fix memory leak on snd_hdac_device_init error
PATCH 1/1 ALSA: hda - Fix memory leak on snd_hdac_device_init error
From: "Subhransu S. Prusty" <[email protected]>
Free codec vendor name on snd_hdac_device_init error.
--- sound/hda/hdac_device.c | 2 ++ 1 file changed, 2 insertions(+)
sound/hda/hdac_device.c +2 -0
@@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,return 0 ; error: +kfree (codec->vendor_name); +put_device (&codec->dev);return err; }
Signature · 1 line
2.15.0
Quoted 15 lines · Guneshwor Singh
From: "Subhransu S. Prusty" <[email protected]>
Free codec vendor name on
snd_hdac_device_initerror.Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Guneshwor Singh <[email protected]>--- sound/hda/hdac_device.c | 2 ++ 1 file changed, 2 insertions(+)sound/hda/hdac_device.c +0
-0
sound/hda/hdac_device.c int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus, · line 114
Quoted 4 lines
sound/hda/hdac_device.c +1
-0@@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,return 0 ; error: +kfree (codec->vendor_name);
Sorry I dont think this is right.
The vendor name is freed in the snd_hdac_device_exit()
We drop the reference here and release method would be called to free up the resources.
Quoted 6 lines
sound/hda/hdac_device.c +0
-0put_device (&codec->dev);return err; }Signature · 1 line
2.15.0
Signature · 1 line
~Vinod
Quoted 24 lines · Vinod Koul
Quoted 15 lines · Guneshwor Singh
From: "Subhransu S. Prusty" <[email protected]>
Free codec vendor name on
snd_hdac_device_initerror.Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Guneshwor Singh <[email protected]>--- sound/hda/hdac_device.c | 2 ++ 1 file changed, 2 insertions(+)sound/hda/hdac_device.c +0
-0sound/hda/hdac_device.c int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus, · line 114
Quoted 4 lines
sound/hda/hdac_device.c +1
-0@@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,return 0 ; error: +kfree (codec->vendor_name);Sorry I dont think this is right.
Quoted 4 lines
The vendor name is freed in the
snd_hdac_device_exit()We drop the reference here and release method would be called to free up the resources.
Correct. The patch would lead to a double-free.
thanks,
Takashi
Quoted 11 lines
Quoted 7 lines
sound/hda/hdac_device.c +0
-0put_device (&codec->dev);return err; }Signature · 1 line
2.15.0Signature · 1 line
~Vinod
Quoted 26 lines · Takashi Iwai
Quoted 24 lines · Vinod Koul
Quoted 15 lines · Guneshwor Singh
From: "Subhransu S. Prusty" <[email protected]>
Free codec vendor name on
snd_hdac_device_initerror.Signed-off-by Subhransu S. Prusty <[email protected]>Signed-off-by Guneshwor Singh <[email protected]>--- sound/hda/hdac_device.c | 2 ++ 1 file changed, 2 insertions(+)sound/hda/hdac_device.c +0
-0sound/hda/hdac_device.c int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus, · line 114
Quoted 4 lines
sound/hda/hdac_device.c +1
-0@@ -111,6 +111,8 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,return 0 ; error: +kfree (codec->vendor_name);Sorry I dont think this is right.
Quoted 8 lines
Quoted 4 lines
The vendor name is freed in the
snd_hdac_device_exit()We drop the reference here and release method would be called to free up the resources.
Correct. The patch would lead to a double-free.
Yes, you are right. Please ignore the patch.
Quoted 16 lines
thanks,
Takashi
Quoted 11 lines
Quoted 7 lines
sound/hda/hdac_device.c +0
-0put_device (&codec->dev);return err; }Signature · 1 line
2.15.0Signature · 1 line
~Vinod