[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170906133811.8072-1-lizhenhuajiyang@163.com>
Date: Wed, 6 Sep 2017 21:38:11 +0800
From: Zhenhua <lizhenhuajiyang@....com>
To: gregkh@...uxfoundation.org, jslaby@...e.com, mingo@...nel.org,
andriy.shevchenko@...ux.intel.com, mail@...iej.szmigiero.name,
mgorman@...e.de, safinaskar@...l.ru, mhocko@...e.com,
linux-kernel@...r.kernel.org
Cc: Zhenhua <lizhenhuajiyang@....com>
Subject: [PATCH 1/1] drivers/tty: check for null pointer
The parameter "handler" is not checked, which may cause system
crash on some broken devices.
Signed-off-by: Zhenhua <lizhenhuajiyang@....com>
---
drivers/tty/vt/keyboard.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index f4166263bb3a..f85c2d8c0b36 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -1455,6 +1455,12 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type,
unsigned int event_code, int value)
{
/* We are called with interrupts disabled, just take the lock */
+
+ if (handle == NULL || handle->dev == NULL) {
+ pr_err("device handler error.");
+ return;
+ }
+
spin_lock(&kbd_event_lock);
if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev))
--
2.14.1
Powered by blists - more mailing lists