Received: by 10.223.185.116 with SMTP id b49csp1022359wrg; Wed, 21 Feb 2018 10:43:22 -0800 (PST) X-Google-Smtp-Source: AH8x227XatDQY0VUedAXWqKRMqHrEh4S63B2kGbzGj/FeO8wOp0LmPgSwH0MRoQEPRU8E6glTQPZ X-Received: by 2002:a17:902:a984:: with SMTP id bh4-v6mr3906204plb.95.1519238601971; Wed, 21 Feb 2018 10:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238601; cv=none; d=google.com; s=arc-20160816; b=l8zubdaEiWjugpxpTbPLWkDhtPr+qmw52okKEgy/aYNzKDYX3RQ2BbHIkF4PaeCV1B HlrhK/Ab7qfZr4E7M5vPPNHXNQz+hz8kZtC/BHusgE1Ea2APEZQxjg4UFrs+ks3HRNjB xoRTXP2QG/d5q98QGjHepDl9A/yQlUQ8i1zwAVYtqNKtvQa2+Py1vnnrrjyQjuN1EKqX Q/vHjxeVcAdxpF9WwaOxe9mUABTriI7Ppn3/jWQs2qhDv4fLTUmlPbZE5r/h0m1bHjmH I5EE8g0UmPpZW5Y6gnJS65WSzUzhh8Nnwg1KE9zE24W/6ecE3j2XkfTBslh8BbcvpUKb 2wXw== 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=VGbO1bFe4tvUedgFy8Oc6sTtZUtxeRoXCXc3CqoVt6s=; b=qb6ZiGqXZ4TR0fMvnIuBaMWvDb+NSPP41aXwBK6fqi3wv8z6oD8W6hRrpl5f4FhJVH b9Qh7eozWCU7hPzKvQvMXYa4MSzYtpJhvUgdQfJR1q6TQC2bE5tcNpSF+CFuowteD6KF MkCrLGVGA1wB2TASL5t/UTvh1vhrB/W2LCqkR2qSygXvCKWR9GYPLqDIivDQz9ywZ+Gj Zz/rlQmSqyYD7tAzNELOnKNBE2T0LOblVYkjsLz22yN2TNJ5BxFc5+FVjZJK+7pMYaVj zh36GEID6PMOWzX+GGd4+R3Dbb3Ldf01OwL1S2weBY0KyeiPZ28H/zQbbY+hfRbQ2Gjj q1lw== 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 f35-v6si1874772plh.475.2018.02.21.10.43.07; Wed, 21 Feb 2018 10:43:21 -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 S965823AbeBUN1W (ORCPT + 99 others); Wed, 21 Feb 2018 08:27:22 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44496 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936313AbeBUNLN (ORCPT ); Wed, 21 Feb 2018 08:11:13 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A51BE124E; Wed, 21 Feb 2018 13:11:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Christophe PLAGNIOL-VILLARD , Nicolas Ferre , Alexandre Belloni , Johan Hovold , Bartlomiej Zolnierkiewicz Subject: [PATCH 4.15 119/163] video: fbdev: atmel_lcdfb: fix display-timings lookup Date: Wed, 21 Feb 2018 13:49:08 +0100 Message-Id: <20180221124536.698588163@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 9cb18db0701f6b74f0c45c23ad767b3ebebe37f6 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 display node was also prematurely freed. Note that the display and timings node references are never put after a successful dt-initialisation so the nodes would leak on later probe deferrals and on driver unbind. Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport") Cc: stable # 3.13 Cc: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Alexandre Belloni Signed-off-by: Johan Hovold Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/atmel_lcdfb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -1119,7 +1119,7 @@ static int atmel_lcdfb_of_init(struct at goto put_display_node; } - timings_np = of_find_node_by_name(display_np, "display-timings"); + timings_np = of_get_child_by_name(display_np, "display-timings"); if (!timings_np) { dev_err(dev, "failed to find display-timings node\n"); ret = -ENODEV; @@ -1140,6 +1140,12 @@ static int atmel_lcdfb_of_init(struct at fb_add_videomode(&fb_vm, &info->modelist); } + /* + * FIXME: Make sure we are not referencing any fields in display_np + * and timings_np and drop our references to them before returning to + * avoid leaking the nodes on probe deferral and driver unbind. + */ + return 0; put_timings_node: