Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp230757ybl; Thu, 22 Aug 2019 23:28:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqww3wlSKz/2+svffSnOCYP50gk7b89SZ9QwvC/5x39CmPS2xoTxpG1Y0z1J/aI9/qFljew5 X-Received: by 2002:a62:3744:: with SMTP id e65mr3468653pfa.69.1566541734748; Thu, 22 Aug 2019 23:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566541734; cv=none; d=google.com; s=arc-20160816; b=M6e/VYL1hIgHfl8kkGLGNwNjnRleLQax8NAxK82J159Mazxh6JlZhUyCcUkXQ0SMyT v7kYaeBnrdmZ7/3mUb6Mn0kFovM5hg2Y/CsNgTNhF6JtXP5x7Tq8ZnJrsIyqqEF6Cwiu 4c8nEPplVUcRhufnn+AdAw/oTemhrZWh2saHLbQRAVJSpEsoAWejBjQJy71IVqQvUnW0 PRQ2l7C5L2kI4/Vg1m/XqkO0tHpRx06IMc3ev4t33aLWWaoLmo9thycyJXRojjUNJEUS 1X/Rx8dTRC8/8inUkoRXkSTeF8u3ZPZGZrORCGdihZqQGRXd06Fo8JbpSH+cfg0Z7agf 19jA== 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=sEtUAQ+Dmj2buVhvAyt3jsMpvnvyoiBG8ModH/I3Gm4PSfkKEjjDSJROmHH7VfzRcV IfWXpBibQyUhqX9Ja0JdaAjl9QV29DMxS+h5TC4lHI7Er4Mkb2qqjHI2KHszRHS8mRjz YyM+nDph+kX9O1WtyqtPg/SyNUhCNhAbmeZTkrYiJq8WvEgqmGPWmSmd703yAlL692fU OfBxsrPtMlwGX8tN5beOiYnpbwIzO3jSYTgUl/0mY9Kuf9Jxkv+vEZhDGN5rvbmxVM2H ovApnBHl9jchcL3onm6l29+pcDcOZLBJm7w2KGNAdfBRNQQLzX7TSDrZQIJnpFCXVXTo cqFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kIlFx+m9; 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 b18si1229389pgl.52.2019.08.22.23.28.37; Thu, 22 Aug 2019 23:28:54 -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=kIlFx+m9; 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 S2392804AbfHVRj7 (ORCPT + 99 others); Thu, 22 Aug 2019 13:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:45298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404105AbfHVRYK (ORCPT ); Thu, 22 Aug 2019 13:24:10 -0400 Received: from localhost (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (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 9F63E2341A; Thu, 22 Aug 2019 17:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566494649; bh=X42x0xK8Yv7JFdRdm38qmeC5UC56ygSVuWr4FXYQzcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIlFx+m9ATshpKd+vVdLLFSpMmrOjgabTVLDrywnPVRbIDS/62hg0GpvXEIttAXRV yC4q9YHd7IcVHwYf+87hbBypZUikzZahWSTHoXdKQg0s3H6uzaPWQ7dlxCvuM8qg7x G6rO5wEJG+jTmkyZ/SiOJ+OtltI5b/z6G2xa2YyI= 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.9 034/103] ALSA: firewire: fix a memory leak bug Date: Thu, 22 Aug 2019 10:18:22 -0700 Message-Id: <20190822171730.198941613@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190822171728.445189830@linuxfoundation.org> References: <20190822171728.445189830@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);