video: fbdev: atmel_lcdfb: fix display-timings lookup

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/9cb18db0701f6b74f0c45c23ad767b3ebebe37f6
Commit:     9cb18db0701f6b74f0c45c23ad767b3ebebe37f6
Parent:     70a02f840c5113cd9255ce4c1b1848bb48b0bd21
Refname:    refs/heads/master
Author:     Johan Hovold <[email protected]>
AuthorDate: Fri Dec 29 19:48:43 2017 +0100
Committer:  Bartlomiej Zolnierkiewicz <[email protected]>
CommitDate: Fri Dec 29 19:48:43 2017 +0100

    video: fbdev: atmel_lcdfb: fix display-timings lookup
    
    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 <[email protected]>     # 3.13
    Cc: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
    Cc: Nicolas Ferre <[email protected]>
    Cc: Alexandre Belloni <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
---
 drivers/video/fbdev/atmel_lcdfb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index e06358da4b99..3dee267d7c75 100644
--- 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 atmel_lcdfb_info *sinfo)
 		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 atmel_lcdfb_info *sinfo)
 		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:
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.