mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Wenwen Wang" <wang6495@umn.edu>
Cc: "moderated list:SOUND" <alsa-devel@alsa-project.org>,
	"Kees Cook" <keescook@chromium.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: usx2y: fix a memory leak bug
Date: Mon, 29 Apr 2019 07:36:29 +0200	[thread overview]
Message-ID: <s5ha7g9l6ea.wl-tiwai@suse.de> (raw)
In-Reply-To: <s5hd0l6mwbz.wl-tiwai@suse.de>

On Sun, 28 Apr 2019 09:18:40 +0200,
Takashi Iwai wrote:
> 
> On Sun, 28 Apr 2019 08:42:32 +0200,
> Wenwen Wang wrote:
> > 
> > In usX2Y_In04_init(), a new urb is firstly created through usb_alloc_urb()
> > and saved to 'usX2Y->In04urb'. Then, a buffer is allocated through
> > kmalloc() and saved to 'usX2Y->In04Buf'. After the urb is initialized, a
> > sanity check is performed for the endpoint in the urb by invoking
> > usb_urb_ep_type_check(). If the check fails, the error code EINVAL will be
> > returned. In that case, however, the created urb and the allocated buffer
> > are not freed, leading to memory leaks.
> > 
> > To fix the above issue, free the urb and the buffer if the check fails.
> > 
> > Signed-off-by: Wenwen Wang <wang6495@umn.edu>
> 
> Applied now, thanks.

... and looking at the code again, this patch turned out to be wrong.
The in04 urb and transfer buffer are freed at card->private_free
callback (snd_usX2Y_card_private_free()) later, so this patch would
lead to double-free.

I dropped the patch now.


thanks,

Takashi

  reply	other threads:[~2019-04-29  5:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28  6:42 Wenwen Wang
2019-04-28  7:18 ` Takashi Iwai
2019-04-29  5:36   ` Takashi Iwai [this message]
2019-04-29  5:50     ` Wenwen Wang
2019-04-29  6:42       ` Takashi Iwai
2019-04-29  6:44         ` Wenwen Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5ha7g9l6ea.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=wang6495@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®