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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7E4AC4332F for ; Wed, 2 Nov 2022 06:37:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A61E91681; Wed, 2 Nov 2022 07:36:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A61E91681 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667371049; bh=BVd0Kurk15J7uD0aFoX4i0SqCgXAa7JLP342me8FzwE=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=b4yxPgzmavLOvIqVQ8jD1MZdPsiEgt8TwH80+Ygjv4vyJNksj4OlVKQ69ftPyavc6 vofBaKO6K/PT1+kQPRIlQP3xYdboXOHXwbrvJ04ny2GuZLYAoOuJP3hO8GDqEOJBZ2 VD18vvh2++cyCpBLgdNVhDd5NcnWvdCyifMwz3MI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 22D78F80254; Wed, 2 Nov 2022 07:36:39 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6A12DF8026D; Wed, 2 Nov 2022 07:36:37 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 66357F80085 for ; Wed, 2 Nov 2022 07:36:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 66357F80085 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RyJ2iFjQ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5FQ41kgw" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3F5191F855; Wed, 2 Nov 2022 06:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1667370990; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CuOQv/5AsFtVYVSdwwMse394DBq94K0CQqQuNCaJjJM=; b=RyJ2iFjQqPTfrbufxSjFwwKyERUUvLFULYFkSzzNcR0rxyWWKKNOiu4tsQy24TWMzPSK2G TV+bGM4t/clXGbEoyPEpueCFMHQaMF1DmDwG6l17XH+xLZPF7HSaWmb2RdoC7s9X76embQ kT0FGElhcVkh2Hq1Wj6za865RAgAOwU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1667370990; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CuOQv/5AsFtVYVSdwwMse394DBq94K0CQqQuNCaJjJM=; b=5FQ41kgwUO6v9YciawVaRnTjpHC5G4I7mNy1ieEFr4+X7n3PSeCRpWsYG6y6zO82UsPXPz m3EnIeX7YQw35xBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1DF50139D3; Wed, 2 Nov 2022 06:36:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XnvbBe4PYmMXUwAAMHmgww (envelope-from ); Wed, 02 Nov 2022 06:36:30 +0000 Date: Wed, 02 Nov 2022 07:36:29 +0100 Message-ID: <87k04d7thu.wl-tiwai@suse.de> From: Takashi Iwai To: Yang Yingliang Subject: Re: [PATCH] ASoC: Intel: avs: fix possible memory leak in probe_codec() In-Reply-To: <9c364bc3-582d-c4ff-9aaf-deeddc30e57b@huawei.com> References: <20221022025804.1221953-1-yangyingliang@huawei.com> <9c364bc3-582d-c4ff-9aaf-deeddc30e57b@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, broonie@kernel.org, cezary.rojewski@intel.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 02 Nov 2022 02:48:30 +0100, Yang Yingliang wrote: > > +Cc: Takashi Iwai > > Hi, is this patch good? Not really. The codec instances are freed later at avs_pci_remove(). Takashi > > Thanks, > Yang > On 2022/10/22 10:58, Yang Yingliang wrote: > > If snd_hda_codec_configure() fails, 'codec' and name allocated in > > dev_set_name() called in snd_hdac_device_init() are leaked. Fix this > > by calling snd_hdac_device_unregister() and put_device(), so they > > can be freed in snd_hda_codec_dev_release() and kobject_cleanup(). > > > > Fixes: 1affc44ea5dd ("ASoC: Intel: avs: PCI driver implementation") > > Signed-off-by: Yang Yingliang > > --- > > sound/soc/intel/avs/core.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c > > index bb0719c58ca4..2fde2b3f8790 100644 > > --- a/sound/soc/intel/avs/core.c > > +++ b/sound/soc/intel/avs/core.c > > @@ -140,6 +140,8 @@ static int probe_codec(struct hdac_bus *bus, int addr) > > ret = snd_hda_codec_configure(codec); > > if (ret < 0) { > > dev_err(bus->dev, "failed to config codec %d\n", ret); > > + snd_hdac_device_unregister(&codec->core); > > + put_device(&codec->core.dev); > > return ret; > > } > > >