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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 9D71DC41514 for ; Thu, 22 Aug 2019 17:08:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FA0523426 for ; Thu, 22 Aug 2019 17:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493713; bh=GvmlOiJYasZWqbCgBV4k6R+68bLpFOF01+lWBu11hSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WTg1D2nf0YAOb5ogAlOMrGFinp7yi2RHyBCWH133f5xx0UOllQVnSEBNPpo3a1MNh bPFTpfU906fpzg+lootJyqB05xVpoHJkKAGI2cV1JHbgoiew9Pc4nTgVF394NQ/r7e VqdeUoIL93tkiVFcqqXBmeNabniRqoUGhmREKVTg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390377AbfHVRIc (ORCPT ); Thu, 22 Aug 2019 13:08:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:58074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390335AbfHVRI2 (ORCPT ); Thu, 22 Aug 2019 13:08:28 -0400 Received: from sasha-vm.mshome.net (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C947923426; Thu, 22 Aug 2019 17:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493706; bh=GvmlOiJYasZWqbCgBV4k6R+68bLpFOF01+lWBu11hSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nl7AJqiCKUG79pec+UY4CISVqMMkIkFGc4fhvFAw4V2zkHY8jbnDFVdDTMhpk+Q1M 1YxGxV0pn6jWqsGuYZdap0S+UrnpfJ/JeZxoQMJhDBcP6kTFCfN9ijn0O6YR+G2zsN Nb2tL8V+/i1a90kZ8oKyNUlFQzXoE23oX2Ion+co= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wenwen Wang , Takashi Iwai , Greg Kroah-Hartman Subject: [PATCH 5.2 021/135] ALSA: hda - Fix a memory leak bug Date: Thu, 22 Aug 2019 13:06:17 -0400 Message-Id: <20190822170811.13303-22-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822170811.13303-1-sashal@kernel.org> References: <20190822170811.13303-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.2.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.2.10-rc1 X-KernelTest-Deadline: 2019-08-24T17:07+00:00 X-stable: review X-Patchwork-Hint: Ignore 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 cfef67f016e4c00a2f423256fc678a6967a9fc09 upstream. In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc(). Then, the pin widgets in 'codec' are parsed. However, if the parsing process fails, 'spec' is not deallocated, leading to a memory leak. To fix the above issue, free 'spec' before returning the error. Fixes: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser") Signed-off-by: Wenwen Wang Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 485edaba0037e..8f2beb1f3ae48 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -6100,7 +6100,7 @@ static int snd_hda_parse_generic_codec(struct hda_codec *codec) err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); if (err < 0) - return err; + goto error; err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); if (err < 0) -- 2.20.1