diff options
author | Samuli Piippo <samuli.piippo@qt.io> | 2017-05-08 09:41:04 +0300 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@qt.io> | 2017-05-08 13:48:36 +0000 |
commit | 81c7688352e0501b5925510cfdca356b2eb29b18 (patch) | |
tree | 6119efea41a408a031b23e6555ecfad13888a631 | |
parent | 6fe3b43c57b8dda54201415e62a50cda15f3cecf (diff) | |
download | meta-boot2qt-81c7688352e0501b5925510cfdca356b2eb29b18.tar.gz |
tegra: fix kernel NULL pointer dereference
Closing Qt application caused video mode to change, which in turn
triggered NULL pointer deference bug in tegra kernel.
Task-number: QTBUG-60417
Change-Id: I0dffc3cd6773637742a1e54f6c495fdde0fbd895
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
-rw-r--r-- | meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch | 43 | ||||
-rw-r--r-- | meta-tegra-extras/recipes/linux/linux-tegra_%.bbappend | 33 |
2 files changed, 76 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 @@ | |||
1 | From 727c2a7dd80589e99b6061f362cf5f1f4d5a84d7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Samuli Piippo <samuli.piippo@qt.io> | ||
3 | Date: Mon, 8 May 2017 08:47:27 +0300 | ||
4 | Subject: [PATCH] fbcon: Compare variable screen info instead of modes (FIX) | ||
5 | |||
6 | Previous commit changed behavior, so that when trying to match a mode to a | ||
7 | variable screen info structure, the mode was first converted to a variable | ||
8 | screen structure rather than the variable screen info structure to a mode. | ||
9 | |||
10 | However, when new mode was being added to the modelist, matching was still | ||
11 | being done using mode structure. This could cause situation, where existing | ||
12 | mode would match when comparing with mode structure, but not when compared | ||
13 | using variable screen info structure. This would eventually result in a | ||
14 | NULL pointer dereference in fbcon_switch. | ||
15 | |||
16 | Fix the issue by using the variable screen info structure also when adding | ||
17 | new mode to the modelist. | ||
18 | --- | ||
19 | drivers/video/modedb.c | 7 ++++--- | ||
20 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
21 | |||
22 | diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c | ||
23 | index 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 | } | ||
diff --git a/meta-tegra-extras/recipes/linux/linux-tegra_%.bbappend b/meta-tegra-extras/recipes/linux/linux-tegra_%.bbappend new file mode 100644 index 0000000..db152a3 --- /dev/null +++ b/meta-tegra-extras/recipes/linux/linux-tegra_%.bbappend | |||
@@ -0,0 +1,33 @@ | |||
1 | ############################################################################ | ||
2 | ## | ||
3 | ## Copyright (C) 2017 The Qt Company Ltd. | ||
4 | ## Contact: https://www.qt.io/licensing/ | ||
5 | ## | ||
6 | ## This file is part of the Boot to Qt meta layer. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE:GPL$ | ||
9 | ## Commercial License Usage | ||
10 | ## Licensees holding valid commercial Qt licenses may use this file in | ||
11 | ## accordance with the commercial license agreement provided with the | ||
12 | ## Software or, alternatively, in accordance with the terms contained in | ||
13 | ## a written agreement between you and The Qt Company. For licensing terms | ||
14 | ## and conditions see https://www.qt.io/terms-conditions. For further | ||
15 | ## information use the contact form at https://www.qt.io/contact-us. | ||
16 | ## | ||
17 | ## GNU General Public License Usage | ||
18 | ## Alternatively, this file may be used under the terms of the GNU | ||
19 | ## General Public License version 3 or (at your option) any later version | ||
20 | ## approved by the KDE Free Qt Foundation. The licenses are as published by | ||
21 | ## the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||
22 | ## included in the packaging of this file. Please review the following | ||
23 | ## information to ensure the GNU General Public License requirements will | ||
24 | ## be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||
25 | ## | ||
26 | ## $QT_END_LICENSE$ | ||
27 | ## | ||
28 | ############################################################################ | ||
29 | |||
30 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
31 | SRC_URI += "\ | ||
32 | file://0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch \ | ||
33 | " | ||