Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1082996ybl; Wed, 14 Aug 2019 10:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMjnKrTlaI3/mgUPb7i7HBKGajMjJZNszx8ugw6mqUxXE1CEowzry9Ey+YkjMFAiR+V9uD X-Received: by 2002:a63:fb14:: with SMTP id o20mr261776pgh.136.1565803508910; Wed, 14 Aug 2019 10:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803508; cv=none; d=google.com; s=arc-20160816; b=fX4OlJauD4+cu3SD+CeqNui1O84cG4P7JbBAi2fQajtfYkvhirvSQITj2kcz9TA2uD SpLMfaz1+7lWBOlkSygIiyGICvN6ib2KxJ44LI/2BQ7h4qoYiiexjp268lKx0dvkgAsu 8dRfgkgLKSriFUMc9ErpiNap5OF4t2CHt0G/BBECqBIuesdJ8AK30kNXb/h5coAMnpZh wLiuzXNF4P0pXIFelWZ6FNwUSL+gh9rwORW2rcdj3Iw9m9skiezAagHtJKj93VQmFMA2 NdcIZjmtTQc/oge2vyGbVh23Eiet1zZu4bB/qvDTn0k9gyKdcdEjUeApKhS4FaVbcety B/sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2S6UHc/D38bT4lcsjayqpyv8gGw1x70fxzun6qXWmmo=; b=w4ijZnphis8uMroBwuDaSZxxtxQcDmqG//k5NMQwnutHVk6fBE70E0LaDjGuXS9iso aDGXqLsZ5E8EhhC85HIYGpcF7JUVOAfr1O8QNOfQNw1S3mg45KKnsCeaf0u5xG/Gm5U1 O2Cy6kgOmTLiu+ty7PWk7/mccp4GuEr1P6NybMCiurFExpRILnhp8zVTAEPHskWk0ngU FM4+NVbt+YJgNwFuobKGIcVe+LF9ARoQ+GZqPSccaitACsK5riLLaP1XFQKZo/vag3kx Usg8P8hg03IdD76EntMXA0zQSVFufT1eilT7kzjYyOM5nxCmSRlybyW3clyiQVzv92tb K2dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mqZmvdXN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i188si68366pfe.96.2019.08.14.10.24.53; Wed, 14 Aug 2019 10:25:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mqZmvdXN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729932AbfHNRXA (ORCPT + 99 others); Wed, 14 Aug 2019 13:23:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:58014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730062AbfHNRII (ORCPT ); Wed, 14 Aug 2019 13:08:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91FE521721; Wed, 14 Aug 2019 17:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802488; bh=8obzKNZ7UGz3iDjYP52sVheyg1q6J65532QJ2C+znhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqZmvdXNSTWkWNQfn+6IFAJFOAvGjbrehInst+/Hvf4b9VbgT60dwTRtqXAzL4NXs T33wbGFD30SoLnKsUjLAjliDuQyMdllveecVMzFJJwdS3XQ0SeeKXQpVf3RPnoAbko 8rzQEliS6Any4p/B2C4Fcu2PNhnAfIUV5FaXGKkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Takashi Iwai Subject: [PATCH 5.2 119/144] ALSA: usb-audio: fix a memory leak bug Date: Wed, 14 Aug 2019 19:01:15 +0200 Message-Id: <20190814165804.907321722@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenwen Wang 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 Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/stream.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1043,6 +1043,7 @@ found_clock: pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) { + kfree(fp->chmap); kfree(fp->rate_table); kfree(fp); return NULL;