Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1065237ybl; Wed, 14 Aug 2019 10:08:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+wYs/dN3S2tQ0Q+iZ/tG0f58e9tdDwV9g7TQ5gTeQsYbqEH1ZpZ98vAIbLPpMXKWnRWVo X-Received: by 2002:a17:902:ab8f:: with SMTP id f15mr376831plr.301.1565802530656; Wed, 14 Aug 2019 10:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802530; cv=none; d=google.com; s=arc-20160816; b=C+BPTK6JUnCzHIPCbOb9dr8J7ZMBtG1vpyfCvG1bafHG1HGaC7WGULHt6gIpozGP4g MwVdHvcucLSjBJ/ZCRVnhAY9DpEhtMydjEQjbELSrfkHjoLhWa+ArjcyqNZuXSj0RjJ7 SgpkGo6Ltt8ePSV3S+DJRppeo2ZpPumzqrY9ivK08lWQYVbeTPlGlNIE6FaMNwBtFxuS cUHvvFfJB23ivJ6S67eLqZKRd0AGrekayQTvvjSahH1eUBhorokr1LoD+BWFoqHyDIQo hgUW0v1kfhfm2kdCioPg/I1NPCVSeF5PMKvJMD6wyS7mzvBYC8JlSfecLOLg4VttdsTL QLTQ== 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=J2O9PqT7Lwqk4R8+FOu6gQcFqCAZYHit1BTEQesVY9w=; b=clq4sNF9wpV3HEgQbAXMvTYU+s1qAFsdAgZaVdNXJuSk8SqUKFNsarsGqtYrDt3Odd s8yToUBUXEwZ4MTRj/gBgMEdib4aZfivOiOFCOVE27P/q3okSi3Bbl4WYkIa/ftVBvSf 6d9XoAq2uGjsueZ810yh8f7TCYFFZQ6N2uUHuyUwdgZTp/dffby9nU0OFyT4JYCRzRJl lXh6QXqDVog79oBRe5/XV4KtLo6Tx4K1uNxnq/VfDKB6wS8VssJTgLHO8PJubeRjgqTn oap1wuK2U48RfQ22bLSsvoCzwyE/u9qDX5oRJ2ylzQX3dLqhj2otkGqgyMq6a4AVgr5+ rb7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lEF533xa; 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 cj2si221637plb.190.2019.08.14.10.08.35; Wed, 14 Aug 2019 10:08:50 -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=lEF533xa; 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 S1729837AbfHNRHU (ORCPT + 99 others); Wed, 14 Aug 2019 13:07:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:56756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729838AbfHNRHR (ORCPT ); Wed, 14 Aug 2019 13:07:17 -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 6BF222084D; Wed, 14 Aug 2019 17:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802436; bh=X42x0xK8Yv7JFdRdm38qmeC5UC56ygSVuWr4FXYQzcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEF533xaPiRmiVnYpTt0mQASMdSvJAWq+ZJuAIQF7MjYFFWy2mlTItR/UWJhjWZFb xJyhogqiWH1B6cT0+uP3gY4pc3a5jrQ3KouVgHkaFQbZDHfPP8m7KA+PQPStJ2Nmw3 3fNFPfY2tog4E5cApqCa4XF/G18HfDBPCWzIVWRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Takashi Sakamoto , Takashi Iwai Subject: [PATCH 5.2 126/144] ALSA: firewire: fix a memory leak bug Date: Wed, 14 Aug 2019 19:01:22 +0200 Message-Id: <20190814165805.203440679@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 1be3c1fae6c1e1f5bb982b255d2034034454527a upstream. In iso_packets_buffer_init(), 'b->packets' is allocated through kmalloc_array(). Then, the aligned packet size is checked. If it is larger than PAGE_SIZE, -EINVAL will be returned to indicate the error. However, the allocated 'b->packets' is not deallocated on this path, leading to a memory leak. To fix the above issue, free 'b->packets' before returning the error code. Fixes: 31ef9134eb52 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver") Signed-off-by: Wenwen Wang Reviewed-by: Takashi Sakamoto Cc: # v2.6.39+ Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/packets-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/firewire/packets-buffer.c +++ b/sound/firewire/packets-buffer.c @@ -37,7 +37,7 @@ int iso_packets_buffer_init(struct iso_p packets_per_page = PAGE_SIZE / packet_size; if (WARN_ON(!packets_per_page)) { err = -EINVAL; - goto error; + goto err_packets; } pages = DIV_ROUND_UP(count, packets_per_page);