From patchwork Mon Jun 10 12:53:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 166321 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp994757ilk; Mon, 10 Jun 2019 05:53:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8FWlqgt//RgfMVDuI6CgDTrpVf+9NI2SNKwX9mOAdifhzdtx0F4VHPdHWGOQ0uno8haT9 X-Received: by 2002:a63:1d1d:: with SMTP id d29mr5588061pgd.259.1560171235871; Mon, 10 Jun 2019 05:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560171235; cv=none; d=google.com; s=arc-20160816; b=0kOQm/MZglPa1lnR8zZJ/iNVTnh7fLyyTkdCWTTFqpI+00PUoLn/Qyou2bSJyf9Oko NlXbD+3B4vpzjBmHymiURnvLvKNLcjbrCJXIedetBtCEnP1FzqAZnQ1xOi9FYrJY+tYt Hif0LfCkLzzVXuaAcnndSWYa2uWf4/zl26MCtJ7nxAAydL3nZj+hrREDMnU/bX9jMKSY qw4E5ukBJ//h5kBQM6JzrMSaeBJwFwh0YGGMVwa9Anjb+X7cUj7ft4YWLR4CyM4afvPM 2VB7LjL4kaxQ4TuLXeVgBZnFUx2BYF3fwn3D8R4hBuone/kZp+ZaqQ+opUBr9B4rOvC1 GNpg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8T69aUvAi+maIZ8yBvTWOJzaeXiOR3Dqg9+a+MoRXDA=; b=XesferWwWYZPmnTr8gaA9OwdVmmbB1i9y2R13UImP+VbmSBwzwebGQwcLcU7MoCaGt qcfTInVaHLlkpdTBtRLvMVAC38SUvSlBVTNDtmoFg1JRZh1Az/HCuTA6l6gCrK5aWNoA 7EWlUZS68+Ql4WHW3j63RRZd8zbhxrb5A7E5cZi+lwWSihCp9eCR7UjHPCakBCtkFmvx 0aTOrMmy4mrwRpqDCpmj/+dxyIVqhwoT8uowGYKOZM+79wEJtp4mjUjvQZpgG5BPnVC9 KF8xJsNepYhnknrgeM6pv/EZhwyrfnXk3gTfC8RVd+rIpKEW9I/NfyUmhIjMdBfnccNX DiiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=n3Fu5kN6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 f7si9478173pgd.155.2019.06.10.05.53.55; Mon, 10 Jun 2019 05:53:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=n3Fu5kN6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389740AbfFJMxz (ORCPT + 8 others); Mon, 10 Jun 2019 08:53:55 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43028 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389441AbfFJMxz (ORCPT ); Mon, 10 Jun 2019 08:53:55 -0400 Received: by mail-wr1-f65.google.com with SMTP id r18so9054522wrm.10 for ; Mon, 10 Jun 2019 05:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8T69aUvAi+maIZ8yBvTWOJzaeXiOR3Dqg9+a+MoRXDA=; b=n3Fu5kN6wdtGKh9YWexo8ZjfsnSBwADVRCC+C4XPOPSXHT5eKEAqT5i79KL9bKa4wd c0hqIJpI7gTWCxibbx6XId2oyRuITeCfXqD/vuxY73kQof26ZidBERPABjLwlljWAlZv /RaBmnpuINADHE0WgkCb9CXCUgwj4Yxvz2Ql+sdrVda1v3DhaMUlSuiQFVX9hxE2M59c 2v8lzULQ5grpGHh307iNtaYcW5R1JoPcHlI5ob+LjUqV8Yn8AMYEPWaBB5TBDRQZQhyb tXVbYg6wQvy59GmMAsTdVK+sHPTjGUCBNjYtFOVx9d4p2BBvJ5leqMnY4TuY0XvTNUme i8Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8T69aUvAi+maIZ8yBvTWOJzaeXiOR3Dqg9+a+MoRXDA=; b=gBk+1K6k8odfJuFlnEZz343MyCAFPk6rKLiRl4qzLcLlsEmGI41Pba6YpDtKQ5vOg9 gd/xPuqDIdOw/hiJ9V8V1S9ZgFSmTwtiyoEYNxlAvuS3DXqx2wJJbyzBiCvXE3s1CEF/ RR6onf7DTK88lnWqy+F+0WZBQpjpKEpFFfBzpiopYJTgI61MeHCxXKUZTEe9TuKJSxZP hTv83OhgoKovtrD5df6sx3mz13Ui2zBX44CwoChhdlqB+E9Ymp1g0O2Q8BercADhajkd HYHEuH6US5CzZCWLENddQijjXlP4ftKSe5ntDdLoke/ce/eWzE0HwNBPCNB8BwaWY032 erHw== X-Gm-Message-State: APjAAAXP7IceKBtk20WGWViXR3meRv4hQa79BA4PUCN5HlmWmh0G0whc NsXYlU68JaGFebFaBtehWvCMlA== X-Received: by 2002:adf:9267:: with SMTP id 94mr22877356wrj.338.1560171233499; Mon, 10 Jun 2019 05:53:53 -0700 (PDT) Received: from boomer.local ([2a01:e34:eeb6:4690:106b:bae3:31ed:7561]) by smtp.googlemail.com with ESMTPSA id 135sm11871603wmb.28.2019.06.10.05.53.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 05:53:53 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood , Kevin Hilman Cc: Jerome Brunet , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, Kuninori Morimoto Subject: [PATCH] ASoC: meson: axg-card: fix null pointer dereference in clean up Date: Mon, 10 Jun 2019 14:53:44 +0200 Message-Id: <20190610125344.18221-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When using modern dai_link style, we must first make sure the struct snd_soc_dai_link_component exists before accessing its members. In case of early probe deferral, some of the '.cpus' or '.codecs' may not have been allocated yet. Check this before calling of_node_put() on the structure member. Fixes: c84836d7f650 ("ASoC: meson: axg-card: use modern dai_link style") Cc: Kuninori Morimoto Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index fb03258d00ae..70bb0cbad233 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -115,9 +115,11 @@ static void axg_card_clean_references(struct axg_card *priv) if (card->dai_link) { for_each_card_prelinks(card, i, link) { - of_node_put(link->cpus->of_node); + if (link->cpus) + of_node_put(link->cpus->of_node); for_each_link_codecs(link, j, codec) - of_node_put(codec->of_node); + if (codec) + of_node_put(codec->of_node); } }