Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1069394ybl; Wed, 14 Aug 2019 10:12:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWCEhAG6XE0PSdppG6Pu8aGaq61l24kSSY0JwwQQKD7KEBmftZW/nNxbJ8IvOL5J5zkgrZ X-Received: by 2002:a17:90a:f0c7:: with SMTP id fa7mr716004pjb.115.1565802733866; Wed, 14 Aug 2019 10:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802733; cv=none; d=google.com; s=arc-20160816; b=t/mBkKnTMT7JCSR/X+ZYpQiKufO8I0+cStXrZH5fzYk7O7EZm83ZjDXNjA0Asb04T/ RelslKvnS9mlQDftF5Opj0F0KNyF09D+IJlaHXPCpIuVbkBlrS0UJFCuu5ykObsZwNIu y2qEx5wnPPNyJst/fkOBALWBKuysOdAREvraJLjRM8gbXQfkPB5Kog9k2WTdGS6rSAU/ pbfYkKzKk9PPSWpNS+kA1LPB54Id8lziWqq5OPSCLtFzsJ7dxdnDtRg/oRmLmUguMY98 heWpO5hJ55VlIOvK28dxylKk08Pi8lk4BScxUshLe/vwVqApQhDcD7F0GWvzzzFAI39F AsAA== 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=vS9YLQn/yVMMkTxQGVq9QhGcEZU0ScOMtd5ndA/DmRn3mrfaDdttjDifWyPYgTdHTd NIJR4ocsWDqdo6rV7aGTlb8GYOtd8zV+Y+cHcgu3//INwSw/xcENOFHQzvQjORyVCJN1 uz0X5N6K75HFzkw+GH/j6VoNNRdNvYTF4oO0SFXipWWl/LxMBqddgjU+eadlHDMI1NB4 BduU2q6bSW/sVR0pq/MaKMCRnNXrHWSlHrC7HIOF6Qq0WYn443uudIemKGpRxyvY4tnx Ggmlfp3vHhFWGsIbliYfz1urDA5IkAGG1jADBphfu3yW/UgbTVVxoFGTRxXcBDtYvylf lW1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B7rAcOe8; 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 i185si172304pge.505.2019.08.14.10.11.57; Wed, 14 Aug 2019 10:12:13 -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=B7rAcOe8; 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 S1730131AbfHNRL1 (ORCPT + 99 others); Wed, 14 Aug 2019 13:11:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:34668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730591AbfHNRLW (ORCPT ); Wed, 14 Aug 2019 13:11:22 -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 B968A2084D; Wed, 14 Aug 2019 17:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802682; bh=X42x0xK8Yv7JFdRdm38qmeC5UC56ygSVuWr4FXYQzcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7rAcOe8mZKV+DFor7H+Cz9XItXEBcoRdm1+1bCtknaQn4r4WdMB5l1MtX4JbnZZ+ j+yhQHkzk8tUTgsN7kmWl+OInKDVMqexYTLLgJcik81n7hn663wDrj9T4pKxgabgXr cTCZhqKh3a3y6oSR4SIP0KLP4Oap25h8sBP9I8As= 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 4.19 77/91] ALSA: firewire: fix a memory leak bug Date: Wed, 14 Aug 2019 19:01:40 +0200 Message-Id: <20190814165753.092767557@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 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);