Received: by 10.223.185.116 with SMTP id b49csp6394058wrg; Wed, 28 Feb 2018 08:41:30 -0800 (PST) X-Google-Smtp-Source: AH8x224kCi6z2+r43B7Rvko2zfrFv4wkCKYjThFAI9+cHbPx8eqvriLwIrZxpKXUATgmw4rR8bGC X-Received: by 10.167.129.67 with SMTP id d3mr18287731pfn.108.1519836090300; Wed, 28 Feb 2018 08:41:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836090; cv=none; d=google.com; s=arc-20160816; b=hVXLJxCjVeiz2WBCK/N954msEtlslDFupUKdm4PHGvKjhOf4zHoIFGtN75J7VquNI0 qHJJm+pS6RabVHpYmPGLJnW0OIeFAzLAbQQW9vENCHWCI9BerbuknrrO14zpO9wfPG9E g1lodot6ACeamCcR2DMXCZSkRb8tyQ+/3wZSdcrwLlXQ3IZN+qbC1tX7p3HAixFe30tG Q6GftS6+f6D+NeCP2N4DFXkc5LBUgcT3PgDxDdebk+6FFm97bmAukqx9phg20bkCqAMQ 3h/g6qBjyHgAeleNS+9c/vMvBh/VS9TN15IJ/UgGcnW/hoI47lLBajoRQ2tmJsdX4EE0 WvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=JzjxjsB8YlyBGNoynh+0lRYf863tx5IsNRfySBpykqY=; b=zuI/gG3n/U/pYQYKLYh6L6YJ/3h4irGzVyNyIbm/1T4zGauNzZ0d603JqBa8ZcZ+hZ vUL1Wo4RlSg+4bts+ZsBVu9TW/sxlQIiJ/skNLflIlowhh5pV8ZlsMci5KNAp++dPFO7 06htWwTyxKJga6SO6h09DU8XZ5H7OXN7ZYfaZlJrVBRaCkHFP8lzo1Hd2+a0NnjzFQg7 DChsTQPiYPaZl2UYadI8Fav//8qZvQ1MHKnUIe+iAxdXtQ3VtWE3VMPVrrEQo6eLvI7N nH1s97KIyFtVcItGZ7aUY08QQb/RS93Z1CUh5YUYPoTa4Ok92RYo3N1C0TBTvuUdr+S/ PBuw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si1526780plr.57.2018.02.28.08.41.15; Wed, 28 Feb 2018 08:41:30 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934147AbeB1QD6 (ORCPT + 99 others); Wed, 28 Feb 2018 11:03:58 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34793 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbeB1QD4 (ORCPT ); Wed, 28 Feb 2018 11:03:56 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yv-0006Xk-DA; Wed, 28 Feb 2018 15:22:33 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yc-0008LA-MA; Wed, 28 Feb 2018 15:22:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Johan Hovold" , "Mark Brown" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 002/254] ASoC: twl4030: fix child-node lookup In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 15f8c5f2415bfac73f33a14bcd83422bcbfb5298 upstream. Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children. To make things worse, the parent codec node was also prematurely freed, while the child node was leaked. Fixes: 2d6d649a2e0f ("ASoC: twl4030: Support for DT booted kernel") Signed-off-by: Johan Hovold Signed-off-by: Mark Brown Signed-off-by: Ben Hutchings --- sound/soc/codecs/twl4030.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -232,7 +232,7 @@ static struct twl4030_codec_data *twl403 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); struct device_node *twl4030_codec_node = NULL; - twl4030_codec_node = of_find_node_by_name(codec->dev->parent->of_node, + twl4030_codec_node = of_get_child_by_name(codec->dev->parent->of_node, "codec"); if (!pdata && twl4030_codec_node) { @@ -241,9 +241,11 @@ static struct twl4030_codec_data *twl403 GFP_KERNEL); if (!pdata) { dev_err(codec->dev, "Can not allocate memory\n"); + of_node_put(twl4030_codec_node); return NULL; } twl4030_setup_pdata_of(pdata, twl4030_codec_node); + of_node_put(twl4030_codec_node); } return pdata;