From 81c7688352e0501b5925510cfdca356b2eb29b18 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 8 May 2017 09:41:04 +0300 Subject: 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 --- ...re-variable-screen-info-instead-of-modes-.patch | 43 ++++++++++++++++++++++ .../recipes/linux/linux-tegra_%.bbappend | 33 +++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 meta-tegra-extras/recipes/linux/linux-tegra/0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch create mode 100644 meta-tegra-extras/recipes/linux/linux-tegra_%.bbappend 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 @@ +From 727c2a7dd80589e99b6061f362cf5f1f4d5a84d7 Mon Sep 17 00:00:00 2001 +From: Samuli Piippo +Date: Mon, 8 May 2017 08:47:27 +0300 +Subject: [PATCH] fbcon: Compare variable screen info instead of modes (FIX) + +Previous commit changed behavior, so that when trying to match a mode to a +variable screen info structure, the mode was first converted to a variable +screen structure rather than the variable screen info structure to a mode. + +However, when new mode was being added to the modelist, matching was still +being done using mode structure. This could cause situation, where existing +mode would match when comparing with mode structure, but not when compared +using variable screen info structure. This would eventually result in a +NULL pointer dereference in fbcon_switch. + +Fix the issue by using the variable screen info structure also when adding +new mode to the modelist. +--- + drivers/video/modedb.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c +index 12dadab..e5093cf 100644 +--- a/drivers/video/modedb.c ++++ b/drivers/video/modedb.c +@@ -2190,13 +2190,14 @@ int fb_add_videomode(const struct fb_videomode *mode, struct list_head *head) + { + struct list_head *pos; + struct fb_modelist *modelist; +- struct fb_videomode *m; ++ struct fb_var_screeninfo v1, v2; + int found = 0; + ++ fb_videomode_to_var(&v1, mode); + list_for_each(pos, head) { + modelist = list_entry(pos, struct fb_modelist, list); +- m = &modelist->mode; +- if (fb_mode_is_equal(m, mode)) { ++ fb_videomode_to_var(&v2, &modelist->mode); ++ if (fb_var_is_equal(&v1, &v2)) { + found = 1; + break; + } 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 @@ +############################################################################ +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Boot to Qt meta layer. +## +## $QT_BEGIN_LICENSE:GPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################ + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI += "\ + file://0001-fbcon-Compare-variable-screen-info-instead-of-modes-.patch \ + " -- cgit v1.2.3-54-g00ecf