public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/tty: check for null pointer
@ 2017-09-06 13:38 Zhenhua
  2017-09-06 13:47 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Zhenhua @ 2017-09-06 13:38 UTC (permalink / raw)
  To: gregkh, jslaby, mingo, andriy.shevchenko, mail, mgorman,
	safinaskar, mhocko, linux-kernel
  Cc: Zhenhua

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-04  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-06 13:38 [PATCH 1/1] drivers/tty: check for null pointer Zhenhua
2017-09-06 13:47 ` Greg KH
     [not found]   ` <151d3a06.73a0.15e577b217f.Coremail.lizhenhuajiyang@163.com>
2017-09-06 14:18     ` Greg KH
2017-10-04  8:20     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox