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
| ||
|
Message-Id: <20231227060322.3556052-1-alexious@zju.edu.cn> Date: Wed, 27 Dec 2023 14:03:20 +0800 From: Zhipeng Lu <alexious@....edu.cn> To: alexious@....edu.cn Cc: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>, linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org Subject: [PATCH] [v2] ALSA: hdsp: fix some memleaks in snd_hdsp_hwdep_ioctl When snd_hdsp_load_firmware_from_cache and snd_hdsp_enable_io fails, the hdsp->fw_uploaded needs to be free.Or there could be memleaks in snd_hdsp_hwdep_ioctl. Fixes: 90caaef6a1ce ("ALSA: hdsp: improve firmware caching") Signed-off-by: Zhipeng Lu <alexious@....edu.cn> --- Changelog: v2: remove label 'err' which is unused. --- sound/pci/rme9652/hdsp.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index e7d1b43471a2..b83b0c484f8e 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -4874,21 +4874,20 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne if (copy_from_user(hdsp->fw_uploaded, firmware_data, HDSP_FIRMWARE_SIZE)) { - vfree(hdsp->fw_uploaded); - hdsp->fw_uploaded = NULL; - return -EFAULT; + err = -EFAULT; + goto free_fw_uploaded; } hdsp->state |= HDSP_FirmwareCached; err = snd_hdsp_load_firmware_from_cache(hdsp); if (err < 0) - return err; + goto free_fw_uploaded; if (!(hdsp->state & HDSP_InitializationComplete)) { err = snd_hdsp_enable_io(hdsp); if (err < 0) - return err; + goto free_fw_uploaded; snd_hdsp_initialize_channels(hdsp); snd_hdsp_initialize_midi_flush(hdsp); @@ -4897,7 +4896,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne if (err < 0) { dev_err(hdsp->card->dev, "error creating alsa devices\n"); - return err; + goto free_fw_uploaded; } } break; @@ -4912,6 +4911,11 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne return -EINVAL; } return 0; + +free_fw_uploaded: + vfree(hdsp->fw_uploaded); + hdsp->fw_uploaded = NULL; + return err; } static const struct snd_pcm_ops snd_hdsp_playback_ops = { -- 2.34.1
Powered by blists - more mailing lists