]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.21/video-fbdev-atmel_lcdfb-fix-display-timings-lookup.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.14.21 / video-fbdev-atmel_lcdfb-fix-display-timings-lookup.patch
1 From 9cb18db0701f6b74f0c45c23ad767b3ebebe37f6 Mon Sep 17 00:00:00 2001
2 From: Johan Hovold <johan@kernel.org>
3 Date: Fri, 29 Dec 2017 19:48:43 +0100
4 Subject: video: fbdev: atmel_lcdfb: fix display-timings lookup
5
6 From: Johan Hovold <johan@kernel.org>
7
8 commit 9cb18db0701f6b74f0c45c23ad767b3ebebe37f6 upstream.
9
10 Fix child-node lookup during probe, which ended up searching the whole
11 device tree depth-first starting at the parent rather than just matching
12 on its children.
13
14 To make things worse, the parent display node was also prematurely
15 freed.
16
17 Note that the display and timings node references are never put after a
18 successful dt-initialisation so the nodes would leak on later probe
19 deferrals and on driver unbind.
20
21 Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport")
22 Cc: stable <stable@vger.kernel.org> # 3.13
23 Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
24 Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
25 Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
26 Signed-off-by: Johan Hovold <johan@kernel.org>
27 Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 drivers/video/fbdev/atmel_lcdfb.c | 8 +++++++-
32 1 file changed, 7 insertions(+), 1 deletion(-)
33
34 --- a/drivers/video/fbdev/atmel_lcdfb.c
35 +++ b/drivers/video/fbdev/atmel_lcdfb.c
36 @@ -1119,7 +1119,7 @@ static int atmel_lcdfb_of_init(struct at
37 goto put_display_node;
38 }
39
40 - timings_np = of_find_node_by_name(display_np, "display-timings");
41 + timings_np = of_get_child_by_name(display_np, "display-timings");
42 if (!timings_np) {
43 dev_err(dev, "failed to find display-timings node\n");
44 ret = -ENODEV;
45 @@ -1140,6 +1140,12 @@ static int atmel_lcdfb_of_init(struct at
46 fb_add_videomode(&fb_vm, &info->modelist);
47 }
48
49 + /*
50 + * FIXME: Make sure we are not referencing any fields in display_np
51 + * and timings_np and drop our references to them before returning to
52 + * avoid leaking the nodes on probe deferral and driver unbind.
53 + */
54 +
55 return 0;
56
57 put_timings_node: