Received: by 10.223.185.116 with SMTP id b49csp6331552wrg; Wed, 28 Feb 2018 07:42:24 -0800 (PST) X-Google-Smtp-Source: AH8x224E8OW9MsaYCVQxo35cBwME8ZUeuwk/r8mOBelBWpuedj0yHLJcwZ7ilvSV1bDUnsx1J3T3 X-Received: by 2002:a17:902:7486:: with SMTP id h6-v6mr18256706pll.216.1519832544611; Wed, 28 Feb 2018 07:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832544; cv=none; d=google.com; s=arc-20160816; b=aWEg9WHpwxrFfaq5fo3alSUt44VWlLfhT8L2CuFnlK+LA4xFj2s3B0iHFRjDXpZzso nf+/4t7o+H+rukGrEqMBXmcCB5R7ZwxEgMCQCJ/WN2ntdGTKLIakYrTxjmSXKmjshYg1 z0JpiIf3CzIi3HmFqKbKPX0dS/Ojo/CZXpmZxJaeZ8LhjD+qGF7h43tPlN64mURwJyZQ L26y+KR5wavNqt/MCfyokXGzPNALPZm8Jponstw9M9VMtTwfQALKzAVchYkNUT6RsfN5 5Ihjk1H3ySjjErOzqezTFYGXwolnIJJABHmHS9UZ3qiJVw3Yf+Ibo+5HakPq190iKJCY DYVQ== 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=ymQZN5BnJMuO8QMQRjbUe7sQ0s90JxEUZrRD9a5QQyY=; b=JPnTKHLckjYy1PZ18GkujgHLmlknX5zexkZxVvIAJNAojFznEyb7U4g/+AFb2K8B+w G4N9Ut0g1yz0uf+Gie8DGIFBt2inJNq1UUFEksvuZpFCb+8kDGaqkcZEa+aN13LYIRWC E6VG7d3AheJ/auzoVj3hET/IGq9bXgNmFLMHyfKcOUk2NlPm0vwrUUVqHnlvRhPAsfuh hPvhWf1nHWWJrirM8scI60uCK/lbIGSvkNNGM6FCkQ8zPwr7+5IdFU9TEmx8l3KBcOHz wQFDNmyok5CEFEzohgYfOrGkRUhY5aCBqPrzOFiKHVe/mPENcNy8u20opnspBrwBjsGV gPcg== 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 f1-v6si1450083plb.73.2018.02.28.07.42.10; Wed, 28 Feb 2018 07:42:24 -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 S933204AbeB1PjC (ORCPT + 99 others); Wed, 28 Feb 2018 10:39:02 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33230 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752720AbeB1PWd (ORCPT ); Wed, 28 Feb 2018 10:22:33 -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 1er3Yf-0006Xk-Dv; Wed, 28 Feb 2018 15:22:17 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yd-0008PD-VS; Wed, 28 Feb 2018 15:22:15 +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, "Peter Ujfalusi" , "Lee Jones" , "Johan Hovold" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 037/254] mfd: twl4030-audio: Fix sibling-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 0a423772de2f3d7b00899987884f62f63ae00dcb upstream. A helper purported to look up a child node based on its name was using the wrong of-helper and ended up prematurely freeing the parent of-node while leaking any matching node. To make things worse, any matching node would not even necessarily be a child node as the whole device tree was searched depth-first starting at the parent. Fixes: 019a7e6b7b31 ("mfd: twl4030-audio: Add DT support") Signed-off-by: Johan Hovold Acked-by: Peter Ujfalusi Signed-off-by: Lee Jones Signed-off-by: Ben Hutchings --- drivers/mfd/twl4030-audio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c @@ -159,13 +159,18 @@ unsigned int twl4030_audio_get_mclk(void EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk); static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata, - struct device_node *node) + struct device_node *parent) { + struct device_node *node; + if (pdata && pdata->codec) return true; - if (of_find_node_by_name(node, "codec")) + node = of_get_child_by_name(parent, "codec"); + if (node) { + of_node_put(node); return true; + } return false; }