Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4383350ioa; Wed, 27 Apr 2022 02:34:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBBidhkyHpZFDa1gX88KgIWWg0jvnfgginvhVFhfbxXaGFnile83rDH7fGEjd/D18mlHzd X-Received: by 2002:aa7:9415:0:b0:50a:cdc8:7d7d with SMTP id x21-20020aa79415000000b0050acdc87d7dmr28930181pfo.30.1651052069010; Wed, 27 Apr 2022 02:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651052069; cv=none; d=google.com; s=arc-20160816; b=0+lkWW9Qc+cXuCT4DX6b1OL0//Ozyq8uJbXdpgHJbgwyYRB07jOREbucAjVHGL59lF 9gSyQI8tSRe0XQWRnQEkhS1Gz6Pz4DIJw8BP9fjp6KJ3VovgWLit/7H8WD+mML1lxegC IC0qonnT2DOhvzKvYAUvgBoFgzwsb/gZQmKLXdE0b4492qia81ywgJecUygebjIvE1Ow Ro5p65VGMKas+v5faYo96SzvkSsJ27BS2073/7oUAAh/1wYtrodpKOF3aPxzL8E3WVdL mbggHkKRDAiBj6MUf/PTNBPnqm10VCyuiwmc5SXhpPFhFciJLuvc6Mpi6kjSJG0hu+0T 4YDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fxor6RtxY05M1ceXlWgJvHtyr2dJTwxTNYlAVCDH3jo=; b=o3zj3rvrcOBcZGqtqLASkdFI0Z3/2xc0g6m1C/32uG9TWVUYWmo9MaTmL1DGozjRVh ryco18SvuLiPgTYpcEE1bVxJG7H6noir48ZV+Zl0saOezh2a/+U0jTjdGdbrDFw1+NVV Zom6qVmxrBakq9jin1/js0qLW3H5tIpQ1WGf0uZ12HORJRev1OQimNtyxoTFcEpeYGTv ijvUdaIZkfcd3KOlOLJlR9UzFzEGJ8P/K0gnrIFvF21NyeW7y0RJK1Fcv3x05AI6kp65 6ZKzvAppuiW0uNs8BMPPelO1upFtIiQV7wGOnK0CP3NrFOgT7u40FPNQPTZtPfrxChcl Ky1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nieMy1TD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d15-20020a056a00244f00b004fa3a8dffc3si927934pfj.122.2022.04.27.02.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:34:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nieMy1TD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 20822261BEB; Wed, 27 Apr 2022 02:14:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236654AbiDZJD1 (ORCPT + 99 others); Tue, 26 Apr 2022 05:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346910AbiDZIp3 (ORCPT ); Tue, 26 Apr 2022 04:45:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DB313DCB; Tue, 26 Apr 2022 01:36:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99FD66185A; Tue, 26 Apr 2022 08:36:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E8F6C385A4; Tue, 26 Apr 2022 08:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962196; bh=GF26Eid8I+SnitU7p4oy6f6kKqZJS6lzRoUxig15UmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nieMy1TDqEuIsWK55tP+E+7xCdDyI26iJeFy3ZWE0EEThWBW9z9gEI0TZQQI/oBSg ZqUkbS/RruXsxzrYko+GOiOmXi8S6D7Bb4lh2EznZj6Jl3XdbZybs3m5N8QexOEkjA YpKZ9WgXwy1ny15Hzdq1IpfZRMUtACzWH5iB2Y7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Ranjani Sridharan , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.15 018/124] ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create() Date: Tue, 26 Apr 2022 10:20:19 +0200 Message-Id: <20220426081747.822568035@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Ujfalusi [ Upstream commit 9c363532413cda3e2c6dfa10e5cca7cd221877a0 ] Academic correction of error handling: In case the allocation of kc or kcontrol_type fails the correct label to jump is hdr_err since the template.sname has been also allocated at this point. Fixes: d29d41e28eea6 ("ASoC: topology: Add support for multiple kcontrol types to a widget") Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220331114957.519-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 561eddfc8c22..eff8d4f71561 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1481,12 +1481,12 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, template.num_kcontrols = le32_to_cpu(w->num_kcontrols); kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL); if (!kc) - goto err; + goto hdr_err; kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), GFP_KERNEL); if (!kcontrol_type) - goto err; + goto hdr_err; for (i = 0; i < w->num_kcontrols; i++) { control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos; -- 2.35.1