Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1074886ybl; Wed, 14 Aug 2019 10:17:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwD5yYDKiVNS4YFLcyk7jg4hR7oxStW24FWq2YHzYE29RmvZva/e5zUZBLDgsXJFZIAOiUZ X-Received: by 2002:a62:cd45:: with SMTP id o66mr1062941pfg.112.1565803033465; Wed, 14 Aug 2019 10:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803033; cv=none; d=google.com; s=arc-20160816; b=u1sT9H+whqjA/bNE/iiREZI4oC0oesdjXVt8HnZ5l8I03ZI1h2RCtUoSyMeeqt2FBH /YuwnjMbbgajH2lAhphXhegRSLLfo1g38aKy4LF+1gb9xhG1EUj00o+5Dkd7xmYNmVlO yN2edAOAc/VmkWiZl+ccpbZUS8tKEW16HxRFc8MJmi4zBkji6yetEbFHrFPJNau3pu2L 1cWCgkbUkzYiepVKua9R4kuS8hqojr2O8X7A7HL0o15opRT3/PQnDtZoydfCzy/0PuMM PZujBjMvT53buqZeqglwkLWGtuepHok6AI8qXfJdv2ujKZfQ6nvvDUjvU39iyF53NRa3 zMZA== 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=baR4kI2YxL52HqRWYUGNJwwej9S4tyMuBcp5Zcb6w4x4T2GoW/qCR8++GbVd3xfHkf kiOS6vlS6Zql015B1TWRGG3nY9y6ZU/AtNFnMOxqkBac3yUWGzBhRHR/vFU8TAcnwvWN IpIWBEqgITDNarRK7RCV5cIn/G5Wlq2trQEw0eRZz2K8OrWjH/kZp8ze/QBvju+MYkEJ cVFHqRoT0CqS6nTarKmOUza2dBSEgwHFs3B7OcyKtXXjImMBY0B2PIHKvSSJ5zfrp1Ul +Nh6QeRjwYNa+/A+LhT8/T9VPQOP+0PMXyafYXMk7RXI5qlZE7xH9sNqeKjERtZl59wH RDgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fMN3PQFx; 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 i10si77937pfr.130.2019.08.14.10.16.57; Wed, 14 Aug 2019 10:17: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=fMN3PQFx; 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 S1731083AbfHNRO0 (ORCPT + 99 others); Wed, 14 Aug 2019 13:14:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:38888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731064AbfHNROY (ORCPT ); Wed, 14 Aug 2019 13:14:24 -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 65AFF2133F; Wed, 14 Aug 2019 17:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802863; bh=X42x0xK8Yv7JFdRdm38qmeC5UC56ygSVuWr4FXYQzcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fMN3PQFxC6rN9oMCh7DH9UKaNSVH9riKPIJe2uMdin1DbOkHq3RG+MTfvDTZaYmNv bCFDDFp6a4w8b4eXVEk00n5wV9SZ/51Dw2ysGgPYM9wTdelcrOBn3qoNE5v9YyNkv7 hhE6RHfn6k5H0jk1dMD6WHXyauTH2K0VcGQUYEyI= 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.14 56/69] ALSA: firewire: fix a memory leak bug Date: Wed, 14 Aug 2019 19:01:54 +0200 Message-Id: <20190814165749.289717396@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@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);