* [PATCH] ALSA: usb: stream: fix potential memory leak during uac3 interface parsing
@ 2018-05-17 22:08 Ruslan Bilovol
2018-05-18 6:52 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Ruslan Bilovol @ 2018-05-17 22:08 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Dan Carpenter, alsa-devel, linux-kernel
UAC3 channel map is created during interface parsing,
and in some cases was not freed in failure paths.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
---
sound/usb/stream.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index bce3152..d16e1c2 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -982,13 +982,16 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
dev_err(&dev->dev, "%u:%d : bogus bTerminalLink %d\n",
iface_no, altno, as->bTerminalLink);
+ kfree(chmap);
return NULL;
found_clock:
fp = audio_format_alloc_init(chip, alts, UAC_VERSION_3, iface_no,
altset_idx, altno, num_channels, clock);
- if (!fp)
+ if (!fp) {
+ kfree(chmap);
return ERR_PTR(-ENOMEM);
+ }
fp->chmap = chmap;
@@ -1009,6 +1012,7 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
iface_no);
/* ok, let's parse further... */
if (snd_usb_parse_audio_format_v3(chip, fp, as, stream) < 0) {
+ kfree(fp->chmap);
kfree(fp->rate_table);
kfree(fp);
return NULL;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: usb: stream: fix potential memory leak during uac3 interface parsing
2018-05-17 22:08 [PATCH] ALSA: usb: stream: fix potential memory leak during uac3 interface parsing Ruslan Bilovol
@ 2018-05-18 6:52 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2018-05-18 6:52 UTC (permalink / raw)
To: Ruslan Bilovol; +Cc: alsa-devel, Dan Carpenter, linux-kernel
On Fri, 18 May 2018 00:08:59 +0200,
Ruslan Bilovol wrote:
>
> UAC3 channel map is created during interface parsing,
> and in some cases was not freed in failure paths.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-18 6:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17 22:08 [PATCH] ALSA: usb: stream: fix potential memory leak during uac3 interface parsing Ruslan Bilovol
2018-05-18 6:52 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox