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

* Re: [PATCH 1/1] drivers/tty: check for null pointer
  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>
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-09-06 13:47 UTC (permalink / raw)
  To: Zhenhua
  Cc: jslaby, mingo, andriy.shevchenko, mail, mgorman, safinaskar,
	mhocko, linux-kernel

On Wed, Sep 06, 2017 at 09:38:11PM +0800, Zhenhua wrote:
> The parameter "handler" is not checked, which may cause system
> crash on some broken devices.

Then those broken drivers need to be fixed.

What specific in-kernel drivers have this problem?

thanks,

greg k-h

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

* Re: [PATCH 1/1] drivers/tty: check for null pointer
       [not found]   ` <151d3a06.73a0.15e577b217f.Coremail.lizhenhuajiyang@163.com>
@ 2017-09-06 14:18     ` Greg KH
  2017-10-04  8:20     ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-09-06 14:18 UTC (permalink / raw)
  To: Li, Zhenhua
  Cc: jslaby@suse.com, mingo@kernel.org,
	andriy.shevchenko@linux.intel.com, mail@maciej.szmigiero.name,
	mgorman@suse.de, safinaskar@mail.ru, mhocko@suse.com,
	linux-kernel@vger.kernel.org


A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Wed, Sep 06, 2017 at 09:57:20PM +0800, Li, Zhenhua wrote:
> when I tried to boot linux on a system with virtual bios and vortual keyboard,
>  it crashes.

What exact "virtual bios and keyboard" are you referring to here?  QEMU?
Something else?

> The root cause is the bios does not initialize devices correctly.

How does the bios come into play here?  It should not matter, it should
only be a kernel driver that can set this value.

> did not track what drivers called this function.

What was the full oops message?  That should show the problem.

And by just rejecting the call here, you are probably just postponing
the real fix from happening, we should resolve that.

thanks,

greg k-h

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

* Re: [PATCH 1/1] drivers/tty: check for null pointer
       [not found]   ` <151d3a06.73a0.15e577b217f.Coremail.lizhenhuajiyang@163.com>
  2017-09-06 14:18     ` Greg KH
@ 2017-10-04  8:20     ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-10-04  8:20 UTC (permalink / raw)
  To: Li, Zhenhua
  Cc: jslaby@suse.com, mingo@kernel.org,
	andriy.shevchenko@linux.intel.com, mail@maciej.szmigiero.name,
	mgorman@suse.de, safinaskar@mail.ru, mhocko@suse.com,
	linux-kernel@vger.kernel.org

On Wed, Sep 06, 2017 at 09:57:20PM +0800, Li, Zhenhua wrote:
> when I tried to boot linux on a system with virtual bios and vortual keyboard,
>  it crashes.
> 
> The root cause is the bios does not initialize devices correctly.

Then please fix the virtual bios :)

thanks,

greg k-h

^ permalink raw reply	[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