Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1773047imm; Thu, 27 Sep 2018 02:12:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV63jzvVlyXsJ2XtRqMxG40iJnk2Pn50+giA8LP6cDH7GtG5Q1Lfyt2aHwrxtnGpHVjdzPewS X-Received: by 2002:a63:6746:: with SMTP id b67-v6mr9297809pgc.310.1538039563622; Thu, 27 Sep 2018 02:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039563; cv=none; d=google.com; s=arc-20160816; b=Gs9U3CU+Wza+EYpayy7D1RnupAPTTSUGrFsDqd5NchcAWRMkrWUlra5efrpIcI6r1B LZCR2VtQMXT6og5Yq3LKwPoSCu3qlOamhPKbIhh6a5ckfHmdOphPYQnNZq6tNHM5P4a4 dXJzQaV9wjb6/BQVc4BfushTgVQ3t4OjXZ5aIfI9n35esHRisYJb9YZpjDNpA6t0NkoK BnTNKZi0j6ZC4PP8c7NJLnm9rMtaty5xJ9TaClMvwF6MYyuFWuIjF93koQlVfYNHM1HR fxig73V2r77ybgRPIAJvwmiizRReOsqIotVxi2d6xLMrUSVHJHAylDsK/YRaF4PQpPy0 WxZQ== 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; bh=hVifAWe8MBkt21nHLQ0k6NDLSSHqB1ZNO3h97EXjKDw=; b=zflYtLQUITVwkAWj34b6IwfVbCGv86bhhE42EjkwF4RIkdD1GiHHNOuPpvFT9tFerV 616LUWkWMGJ0O+Sdy+SjILrxEbYmK/CFE+97W5yErE8r8q/6xitwJMOMpJc+nB3QaDDf /OFebOp/Sj6/Csak42g8jFk20tw+phJY6jDME3DYnK2OD3FcbhGOA2QXzb87UssMEO9T 4XsRQwB36PpsHNCBcHI+49c+VlD1cmWdq/UkgDEcOBm0yJBzOdiClAs5LI2YIfZTkEPB DtJ9u/AsHPg1RfckU9E3/2xH6qiscZ7DxvJQY8XdF7ChuXmX2VkZVjAEjkKyB0TGDhuC wsSg== ARC-Authentication-Results: i=1; mx.google.com; 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 s63-v6si1590003pfj.226.2018.09.27.02.12.28; Thu, 27 Sep 2018 02:12:43 -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; 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 S1728279AbeI0P2v (ORCPT + 99 others); Thu, 27 Sep 2018 11:28:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55280 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbeI0P2v (ORCPT ); Thu, 27 Sep 2018 11:28:51 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B617810A4; Thu, 27 Sep 2018 09:11:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai Subject: [PATCH 4.18 38/88] ALSA: oxfw: fix memory leak of discovered stream formats at error path Date: Thu, 27 Sep 2018 11:03:19 +0200 Message-Id: <20180927090305.295755978@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Sakamoto commit 1064bc685d359f549f91c2d5f111965a9284f328 upstream. After finishing discover of stream formats, ALSA OXFW driver has memory leak of allocated memory object at error path. This commit releases the memory object at the error path. Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card') Cc: # v4.7+ Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/oxfw/oxfw.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -207,6 +207,7 @@ static int detect_quirks(struct snd_oxfw static void do_registration(struct work_struct *work) { struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work); + int i; int err; if (oxfw->registered) @@ -269,6 +270,12 @@ error: snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); if (oxfw->has_output) snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); + for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; ++i) { + kfree(oxfw->tx_stream_formats[i]); + oxfw->tx_stream_formats[i] = NULL; + kfree(oxfw->rx_stream_formats[i]); + oxfw->rx_stream_formats[i] = NULL; + } snd_card_free(oxfw->card); kfree(oxfw->spec); oxfw->spec = NULL;