Received: by 10.223.185.116 with SMTP id b49csp734906wrg; Wed, 21 Feb 2018 06:08:39 -0800 (PST) X-Google-Smtp-Source: AH8x225MJ0ZdWXujCpMj/+pgKS8A7GZrDhfsKQUkR+8XSpqk6Ra7uvzAuUlCoTcBrYyFg9c9dxoX X-Received: by 2002:a17:902:c1:: with SMTP id a59-v6mr3214754pla.284.1519222119887; Wed, 21 Feb 2018 06:08:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519222119; cv=none; d=google.com; s=arc-20160816; b=duWTnY9JM3YTG/kkPTz7AgXNgJ+EHGVBbnpMeGi3pvcm/01crrkpTLrkeh0YexRpYT vU5JgD7Vhu8z/7DJaATVu/Vt5g6zB4R8xE5tsv5RH4CvEL3KQCNZdKYwDfc86Z+73rpL fi3eo7ZDku2Z+7PI7jQOiVUpPz9/RPodJ+TSZvH03Yl5iMyj6sMHFjKSdQqnwlg1w5B6 nQ+ewCe3agzo1gmaLpO6/PZjvuHEgQQA51gWIKTg0gmOnU9PnTmcQ/lRN3CrU/8daZwz ek6ur1OAyqVT9QTxlU6Ah104H8Nx1+fkF4TDQNBoCNP2/ms5HCHOgMEq4csAZkxF0V6+ rl1w== 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=J2rAazOcLGEL83i+h9uopf/HPMzewKOMjr44bgRXjp0=; b=0eLk1GgyN8Em88sdwtMsSu351ZTGhZ8gWnQty7LjsTwPU6ReqaZ/ZVu8VyR4kLyNlr xzNvp0VGRhYDMYoexjqPfs4ff07eKwAEOKcS40Gjx8h8KMF0XVWsxi+zIRxe0deUJipk aTc59zrOQ4bt0q5QUxfJCZwciOCvFNvQNHV+5xCxl0K8v4Xa+sEb2xITqrZOIOZQciU/ O/TXAZGRiT6rwS5zybdzZmtLO+NXQcoTXBLaxOVsD7tSB9QV/C3v2eqcCI4IPuSlt7zO D0PNUxunOY6pc9iP1X4UfqEEsTepoBS6zTWh4QlDVm/B0npiHQCOFFMRzBNpGQsuzw+x eGWA== 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 s195si6543103pgc.39.2018.02.21.06.08.23; Wed, 21 Feb 2018 06:08:39 -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 S935664AbeBUNDB (ORCPT + 99 others); Wed, 21 Feb 2018 08:03:01 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39352 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935606AbeBUNC6 (ORCPT ); Wed, 21 Feb 2018 08:02:58 -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 1D4C01075; Wed, 21 Feb 2018 13:02:57 +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.14 116/167] video: fbdev: atmel_lcdfb: fix display-timings lookup Date: Wed, 21 Feb 2018 13:48:47 +0100 Message-Id: <20180221124530.764473157@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@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.14-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: