lkml.org 
[lkml]   [2017]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] drivers/tty: check for null pointer
Date
The parameter "handler" is not checked, which may cause system
crash on some broken devices.

Signed-off-by: Zhenhua <lizhenhuajiyang@163.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

\
 
 \ /
  Last update: 2017-09-06 15:54    [W:0.078 / U:7.760 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site