Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1078665ybl; Wed, 14 Aug 2019 10:20:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/BzfKBc7QPZeuC5s+c0VA/HO3u3GPCTCI1a0mmQOqDEX42LzGNmxRB2DGCAUXiJAGqrd5 X-Received: by 2002:a17:90b:14c:: with SMTP id em12mr828493pjb.28.1565803247192; Wed, 14 Aug 2019 10:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803247; cv=none; d=google.com; s=arc-20160816; b=0IoteVpe0T1JvB9qhpyqprIxFgaEDGpJY8dFzlO9UYpME21h8XU+xDcSfKk5rbsixr P9XyDn4Muz1HWGsj5ev0XwRoAcLbXvImGrrA3rtaxxqo64vPneG5Oykq3GjZm++43pJM 0bHEAjVK5K142I0X7//W1JcF6jutYUZDiwv1OZz9xztpIDASsLaShKdN1w1sM4QbJkxS oti2jDr+D+yrd2elEgGG3gtXVcnPqo1l8CJt2kGTYfKXJggGeOpGydE4XZbXo7hImAWZ BHx3pFPVIXt3ioanIpG+TIn4iZvC0ownV9Irx+mi2f5JxD3fQtEX/Xuu8qF+i0BrvAML U+pw== 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=clv96a5J5638qAucry6kevHWdYiJUvfEwxxA3UmI4sE=; b=o8lHooA5BTudBjtW4hLldFj7qtzzDmhcclscQsUsYZMYqXyvxRLzuX6rA6FwPoV0Da 3hcdDqQk6SW0Ogm8vBZtwVGEatHs6Cen67FPN+7u8Z8f+jD3ivFxEeyeTBVQbOF6CxJ0 74i5D3g5teFeKNpGzPB7cxGh64AEoOPyD77qctHRUjIhI/JdcNywVvs484TjD+uKrudI Y0wERVNKOwQlZ4+krYedSx5lcOicZNbYKXjxF6mGQD4fvQm9hAapnG7rgQFjCVyPAP7D W7V5ZSJkeBHEjtP2AmNJxaPcLHVDNlhR25+GrZGj5wIQbjBrEz0wwNQbZxKpzDjXZgiL ZTCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IXUsGxAv; 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 t23si243816plr.108.2019.08.14.10.20.31; Wed, 14 Aug 2019 10:20:47 -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=IXUsGxAv; 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 S1730635AbfHNRUC (ORCPT + 99 others); Wed, 14 Aug 2019 13:20:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:34354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730047AbfHNRLK (ORCPT ); Wed, 14 Aug 2019 13:11:10 -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 2B469214DA; Wed, 14 Aug 2019 17:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802669; bh=AHWUpoMKIU/hMxsyuBEYRj2U3/8RmdJg0tIgVoejCkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXUsGxAvtdPgG2AqN75oXyTADeUXwbpM3VEuGCXu1k4bMGgw7EaTZNlJNWRkzJI2q JKonQV/XaD+pW0qSUM0tYY+sVwFFEfU5gMMt8Cf8SAwVVlvSUm44DC8pC/Jjp8AUSF KfcZw+hHkCQac5qeC+UVeX6WCKQnpat6/amdA/uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Takashi Iwai Subject: [PATCH 4.19 72/91] ALSA: usb-audio: fix a memory leak bug Date: Wed, 14 Aug 2019 19:01:35 +0200 Message-Id: <20190814165752.743785887@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@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 @@ -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;