lkml.org 
[lkml]   [2019]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 72/91] ALSA: usb-audio: fix a memory leak bug
    Date
    From: Wenwen Wang <wenwen@cs.uga.edu>

    commit a67060201b746a308b1674f66bf289c9faef6d09 upstream.

    In snd_usb_get_audioformat_uac3(), a structure for channel maps 'chmap' is
    allocated through kzalloc() before the execution goto 'found_clock'.
    However, this structure is not deallocated if the memory allocation for
    'pd' fails, leading to a memory leak bug.

    To fix the above issue, free 'fp->chmap' before returning NULL.

    Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
    Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    sound/usb/stream.c | 1 +
    1 file changed, 1 insertion(+)

    --- a/sound/usb/stream.c
    +++ b/sound/usb/stream.c
    @@ -1053,6 +1053,7 @@ found_clock:

    pd = kzalloc(sizeof(*pd), GFP_KERNEL);
    if (!pd) {
    + kfree(fp->chmap);
    kfree(fp->rate_table);
    kfree(fp);
    return NULL;

    \
     
     \ /
      Last update: 2019-08-14 19:26    [W:4.489 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site