From: Sasha Levin <sasha.levin@oracle.com>
Date: Tue, 27 May 2014 23:08:36 +0000 (-0400)
Subject: Staging: speakup: don't die if accessing sysfs without synth
X-Git-Tag: firefly_0821_release~176^2~3465^2~39^2~103
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8b9c012a425b23c1df52cc1ddfec8259035c6754;p=firefly-linux-kernel-4.4.55.git

Staging: speakup: don't die if accessing sysfs without synth

Setting a 'silent' parameter without a synth would crash the kernel.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 0b3549bd909d..172cf62b1aaf 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -212,6 +212,9 @@ void synth_start(void)
 
 void spk_do_flush(void)
 {
+	if (!synth)
+		return;
+
 	speakup_info.flushing = 1;
 	synth_buffer_clear();
 	if (synth->alive) {