From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F1B3C3A5A1 for ; Thu, 22 Aug 2019 17:40:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4366323402 for ; Thu, 22 Aug 2019 17:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566495604; bh=X42x0xK8Yv7JFdRdm38qmeC5UC56ygSVuWr4FXYQzcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SytYCuqSqnNrCjN/ekgVIGkLNdZVDiZkYo2l/sgT2xVKVQR2S/zRAbpBM/2M2/zKa F0+C+0jM6MWLOjZZaMP5o+Ovi4yw5XZF8tThxgxlPjLDG+yROQkAPgFlRcr1XOTiXU fNi+pnMGIstFLd+qabgocMDaumqhk1uI0zuZII4E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392336AbfHVRjz (ORCPT ); Thu, 22 Aug 2019 13:39:55 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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);