Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1949677ima; Thu, 25 Oct 2018 07:27:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5de3fFbnusjg+Ymi9HC1hUxbDrCs/ZUlXEGHR5n0WZEt+f3jssDLPohw4ZDuC2eYpm+Pp67 X-Received: by 2002:a63:ec11:: with SMTP id j17-v6mr1669703pgh.388.1540477641425; Thu, 25 Oct 2018 07:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477641; cv=none; d=google.com; s=arc-20160816; b=XVWc15gCcNxyzYfZCdSxQw+GNuUreHWjktP82Uh8OaH+5wu7QKmPeFczMxevdJok4r bIlfXijbke8xaynDL0OpSqRw4dBNQ90ZAB4RpKeQBXareyAKjNAC+lUXN5tyOmsKvFIi BsSqVoEvLfff73fiyCVvFZjtkp+Gd2EmdgUmXsZNgfdvZERlD3dv3Eur/VDEWQekNTZ8 c5zVgvpduG1m+pMqjxadmEi8Du4FKbBTsksMnLf2S59LajDnLzwbw/0sbcCFLpu3mLIU ZZ98d5NcC96nNJKPhLOyt5C+G4BTsWpf82CnCL3boMdU2e6SpinqC6IjsPmL4QPJ9tC+ +ByA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=WO4ZbBTUMKuE9AyO8zbd+0dKEwt/WFFYb7SkSm4Cpwc=; b=F3PG8FALJ6nEJzDTOPS+/X7jaO0jT8Eq9T4dUqJjZyRACmcV87tZPRYiCwdrR9AvIU pTgIgDCTurgUXGrMwJYTEfE6qvZgNapUSni4lJurJfSA02tAGeD1GrCrqNRiWPCzjMXR EpHdBjmtOhZFeGJyw+XkegywXfXTJDt3nfBEmRbu8N0poSnpsWibgPXB/1wr7KToIWKU MpfXlpPk+B/ejV+p7Ngl8975Hc2G7fDpgnKQs9skXdoR22pzjSroUKCtHiEsLRf+aA03 +l5jGB9qSn/g0et/v0fyxhD5AFDOmJEpZBcYue9S04FyYNS48YP0juKo2OXv3ms+MG3E F7Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G08Rp2mw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8-v6si7476848pgq.296.2018.10.25.07.26.28; Thu, 25 Oct 2018 07:27:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=G08Rp2mw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731169AbeJYWxn (ORCPT + 99 others); Thu, 25 Oct 2018 18:53:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:36336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729491AbeJYWxl (ORCPT ); Thu, 25 Oct 2018 18:53:41 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (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 00D2920873; Thu, 25 Oct 2018 14:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477244; bh=CIHqw0/4NBhvW71AY1KjYce+F6Lcb50bkkVc5qPfFZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G08Rp2mwG+K6s/fqmx4xkXTDbY3Y/aCvfs6GvOcNwRs0YhT5juPMhReNqvdKGBSyJ goBpG3Um4du3v3Jc4pj+UwjWh2UT/e3U3jxDEwHabTnKiOjfcVwz2z+IfrugutncAz KBX81WM3q3y7HMa6GwcudgtwARsICJpmnzZNBEd0= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 3.18 72/98] ASoC: dapm: Don't add prefix to widget stream name Date: Thu, 25 Oct 2018 10:18:27 -0400 Message-Id: <20181025141853.214051-72-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars-Peter Clausen [ Upstream commit a798c24a69b64f09e2d323ac8155a36373e5d5fd ] Commit fdb6eb0a1287 ("ASoC: dapm: Modify widget stream name according to prefix") fixed the case where a DAPM route between a DAI widget and a DAC/ADC/AIF widget with a matching stream name was not created when the DAPM context was using a prefix. Unfortunately the patch introduced a few issues on its own like leaking the dynamically allocated stream name memory and also not checking whether the allocation succeeded in the first place. It is also incomplete in that it still does not handle the case where stream name of the widget is a substring of the stream name of the DAI, which is explicitly allowed and works fine if no DAPM prefix is used. Revert the commit and take a slightly different approach to solving the issue. Instead of comparing the widget's stream name to the name of the DAI widget compare it to the stream name of the DAI widget. The stream name of the DAI widget is identical to the name of the DAI widget except that it wont have the DAPM prefix added. So this approach behaves identical regardless to whether the DAPM context uses a prefix or not. We don't have to worry about potentially matching with a widget with the same stream name, but from a different DAPM context with a different prefix, since the code already makes sure that both the DAI widget and the matched widget are from the same DAPM context. Fixes: fdb6eb0a1287 ("ASoC: dapm: Modify widget stream name according to prefix") Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- sound/soc/soc-dapm.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d8ac9e5e2c00..d15c34e2f04f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3087,16 +3087,10 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, } prefix = soc_dapm_prefix(dapm); - if (prefix) { + if (prefix) w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); - if (widget->sname) - w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix, - widget->sname); - } else { + else w->name = kasprintf(GFP_KERNEL, "%s", widget->name); - if (widget->sname) - w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname); - } if (w->name == NULL) { kfree(w); return NULL; @@ -3422,7 +3416,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) break; } - if (!w->sname || !strstr(w->sname, dai_w->name)) + if (!w->sname || !strstr(w->sname, dai_w->sname)) continue; if (dai_w->id == snd_soc_dapm_dai_in) { -- 2.17.1