Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3056462imm; Sun, 1 Jul 2018 11:13:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI6CKP+nBDauf+ToSbaWbzkhEiZ4KkpcZX4s3TmNiwHWPtfo9Rzj1krmb0zgLLCf+DmCsjs X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr22860664plb.198.1530468792169; Sun, 01 Jul 2018 11:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530468792; cv=none; d=google.com; s=arc-20160816; b=Fn2iCWYafuNA5aGOoFar3YN5xNgjX0vjq8VeEvBFX1QemHc6xdlOH6znGr/Lx0s62A Lnl+88NYv3a5tC+sSuXokD+8hGpPUK8PAsxlMllknPfcW649nipaYQPs2U96/xzSZYe7 h0P3RpqnorYF6HT2T/61vuI42fzL9AOd2Tcw3kbjsePuwrlFLNnE/NkP1VkgTY1qBAhj MfNOATk/Vom2CY7JIdqZCWjX4UcJ1+s5EZb3/MOWJysz7U8x9i9UtClPqvLNAAfROTvi 0SmW989R6iGHjFNcyCLuuwQV7Bv3/3cIXnKL6mfC9m1ilpUHZpNcvHA+F+9Dcz0eVaeH 0QjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9zx3f05Wc0v7XOrk7todym0XZD+nn8KO4j7HJD8sanI=; b=R/JguPWWD3Q0LD0roq/dtF2Qfhj8CCiMfetBM2X9EuzWrl6brWr31RL+3ilvY4jbsN sVuu3rcyrbehIbatydc8bVZtIsfi9ePAYO2tSkPrzUO9lAPphrz1e++pjx/Bw6iIw3UJ 7+5tWKD75K3jBtlTgHBJ1qg9NZB9bXA3yj3vh4VGIeOHao6KIJrnExgl83R5BbFUCqLN 4G+OsszoMkoGCUUF/FAHA1BRPBOuzy6PjmMkmJPQo7wGLUSB0o2sm3FAWS6Kit042nrG 8xEFhUoEUhTZcUubt0R3CKzrZ78HOoCpgVlL8rOV2UMunsdkGZazRKUaIGb0WBSt3sk4 /laQ== 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 h2-v6si9315048pfg.126.2018.07.01.11.12.58; Sun, 01 Jul 2018 11:13:12 -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; 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 S965658AbeGASLk (ORCPT + 99 others); Sun, 1 Jul 2018 14:11:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34126 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965312AbeGAQ1d (ORCPT ); Sun, 1 Jul 2018 12:27:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C3E3C92B; Sun, 1 Jul 2018 16:27:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Daniel Thompson , Lee Jones Subject: [PATCH 4.9 072/101] backlight: max8925_bl: Fix Device Tree node lookup Date: Sun, 1 Jul 2018 18:21:58 +0200 Message-Id: <20180701160800.045789979@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit d1cc0ec3da23e44c23712579515494b374f111c9 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 mfd node was also prematurely freed, while the child backlight node was leaked. Cc: stable # 3.9 Fixes: 47ec340cb8e2 ("mfd: max8925: Support dt for backlight") Signed-off-by: Johan Hovold Acked-by: Daniel Thompson Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- drivers/video/backlight/max8925_bl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(st if (!pdata) return; - np = of_find_node_by_name(nproot, "backlight"); + np = of_get_child_by_name(nproot, "backlight"); if (!np) { dev_err(&pdev->dev, "failed to find backlight node\n"); return; @@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(st if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val)) pdata->dual_string = val; + of_node_put(np); + pdev->dev.platform_data = pdata; }