Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2344941imm; Thu, 7 Jun 2018 09:06:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKr/JixE1RUKGwmggTbguXMeSWr2j8bKgyWYEuOsGfFjGmj7bET9c49mKxa2uHtseBwCyNF X-Received: by 2002:a63:a557:: with SMTP id r23-v6mr2073782pgu.336.1528387586304; Thu, 07 Jun 2018 09:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387586; cv=none; d=google.com; s=arc-20160816; b=hoReMtWs8hZvlmX+4tJrhnpnTJDJ9NCoU+m+nsQYfOdttCdN/Ls2/6hLpDbNU7Y5oI k15eIGTHXcAcOiuyeDe4DuVG6puP9I9lYINflIMhbEUXzM0igkvkfYxtp4zd+Ksy9say U/SqIlKs80h9w81s+y1I/6et7yn7RcuYtmAgeLG/xN5PYd/joIclXc399y2s0RE4XRPR 7U+8TQ+Bg0Yc4AzgaS319ydyTrj5/0Y+B5UZSKlgBgmptwWhj4XQajjBbQFN8OfGmyJx iU7LVh7zgMEf6QFuZ6brjH/+vFcg7sBCGEWYdfNNizJ8x5glN0qbXBUhEA1nSEBfZi7J CPAw== 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=fJTNHFmSg3lU4V3ZZJfCK5eNTlrtRSwdNw7ZDF9VTHE=; b=hi04DjmSoddx98fgznn9B1XcqPUJlyDWU1HshVAIAU9JU9uUWmDc9pVEjtYKMeI9/c 3+rhNKwt+amJF4Yn1Tpz5pmJVS8tJNyLUwOj2i98/jWQ5ItWE0FIfCN8fmhTiMnNrIoM BG75CavFohbFnKn1pxPKmVTBY6ON7VoNskM5cSJIRoP6doNiyF7Vf/t/mAPomCVCqJ0+ SZgHASvU8Opu04kNyVcrrHTeflMlS+WbzFpUNXBjflCDb1W8POVfdN9GSndVpHBSHl3r L9y9rd4/F0sI1ZgrugC3WkosvVPRUJL2x1Udd388GtIDuPnZ/Y66OoLF++Jc5NuNb/o5 q0xQ== 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 o10-v6si20722690pgp.153.2018.06.07.09.06.11; Thu, 07 Jun 2018 09:06:26 -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 S933676AbeFGQDx (ORCPT + 99 others); Thu, 7 Jun 2018 12:03:53 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39277 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933024AbeFGOJE (ORCPT ); Thu, 7 Jun 2018 10:09:04 -0400 Received: from [148.252.241.226] (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 1fQvb4-0005Zm-Cr; Thu, 07 Jun 2018 15:09:02 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb1-0002od-1A; Thu, 07 Jun 2018 15:08:59 +0100 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, "Bartlomiej Zolnierkiewicz" , "Jean-Christophe PLAGNIOL-VILLARD" , "Johan Hovold" , "Alexandre Belloni" , "Nicolas Ferre" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 092/410] video: fbdev: atmel_lcdfb: fix display-timings lookup In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 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.57-rc1 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: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Alexandre Belloni Signed-off-by: Johan Hovold Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Ben Hutchings --- 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 @@ -1105,7 +1105,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; @@ -1126,6 +1126,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: