lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220907065917.55810-1-niejianglei2021@163.com>
Date:   Wed,  7 Sep 2022 14:59:17 +0800
From:   Jianglei Nie <niejianglei2021@....com>
To:     perex@...ex.cz, tiwai@...e.com
Cc:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        Jianglei Nie <niejianglei2021@....com>
Subject: [PATCH] ALSA: hda/ca0132: fix potential memory leak in dspxfr_image()

dspxfr_image() allocates DSP ports for the download stream with
dsp_allocate_ports_format(). When gets some error, the allocated
DSP ports are not released, which will lead to a memory leak.

We can fix it by releasing DSP ports with dsp_free_ports() when
getting some error.

Signed-off-by: Jianglei Nie <niejianglei2021@....com>
---
 sound/pci/hda/patch_ca0132.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 208933792787..6b8f45e14075 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -3455,6 +3455,7 @@ static int dspxfr_image(struct hda_codec *codec,
 					&port_map_mask);
 	if (status < 0) {
 		codec_dbg(codec, "alloc ports fail\n");
+		dsp_free_ports(codec);
 		goto exit;
 	}
 
@@ -3463,6 +3464,7 @@ static int dspxfr_image(struct hda_codec *codec,
 			WIDGET_CHIP_CTRL, stream_id, 0, &response);
 	if (status < 0) {
 		codec_dbg(codec, "set stream chan fail\n");
+		dsp_free_ports(codec);
 		goto exit;
 	}
 
@@ -3470,6 +3472,7 @@ static int dspxfr_image(struct hda_codec *codec,
 		if (!is_valid(fls_data)) {
 			codec_dbg(codec, "FLS check fail\n");
 			status = -EINVAL;
+			dsp_free_ports(codec);
 			goto exit;
 		}
 		status = dspxfr_one_seg(codec, fls_data, reloc,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ