summaryrefslogtreecommitdiffstats
path: root/meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch')
-rw-r--r--meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch b/meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch
new file mode 100644
index 0000000..c700e0e
--- /dev/null
+++ b/meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch
@@ -0,0 +1,43 @@
1From 727c2a7dd80589e99b6061f362cf5f1f4d5a84d7 Mon Sep 17 00:00:00 2001
2From: Samuli Piippo <samuli.piippo@qt.io>
3Date: Mon, 8 May 2017 08:47:27 +0300
4Subject: [PATCH] fbcon: Compare variable screen info instead of modes (FIX)
5
6Previous commit changed behavior, so that when trying to match a mode to a
7variable screen info structure, the mode was first converted to a variable
8screen structure rather than the variable screen info structure to a mode.
9
10However, when new mode was being added to the modelist, matching was still
11being done using mode structure. This could cause situation, where existing
12mode would match when comparing with mode structure, but not when compared
13using variable screen info structure. This would eventually result in a
14NULL pointer dereference in fbcon_switch.
15
16Fix the issue by using the variable screen info structure also when adding
17new mode to the modelist.
18---
19 drivers/video/modedb.c | 7 ++++---
20 1 file changed, 4 insertions(+), 3 deletions(-)
21
22diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
23index 12dadab..e5093cf 100644
24--- a/drivers/video/modedb.c
25+++ b/drivers/video/modedb.c
26@@ -2190,13 +2190,14 @@ int fb_add_videomode(const struct fb_videomode *mode, struct list_head *head)
27 {
28 struct list_head *pos;
29 struct fb_modelist *modelist;
30- struct fb_videomode *m;
31+ struct fb_var_screeninfo v1, v2;
32 int found = 0;
33
34+ fb_videomode_to_var(&v1, mode);
35 list_for_each(pos, head) {
36 modelist = list_entry(pos, struct fb_modelist, list);
37- m = &modelist->mode;
38- if (fb_mode_is_equal(m, mode)) {
39+ fb_videomode_to_var(&v2, &modelist->mode);
40+ if (fb_var_is_equal(&v1, &v2)) {
41 found = 1;
42 break;
43 }