Skip to contentSkip to conversation

doubletalk: probe failure causes OOPS

PATCH In review Alan Cox 2 participants 2 messages Dec 15, 2014 – Jan 20, 2015 Staging

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 doubletalk: probe failure causes OOPS

The code bothers to probe for the device, but on failing to find it proceeds to try and release a NULL resource, thereby ruining it's prior good behaviour

Resolves-Bug: https://bugzilla.kernel.org/show_bug.cgi?id=88581

---
 drivers/staging/speakup/speakup_dtlk.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/speakup/speakup_dtlk.c +4 -3
index d7d5152..ffd85e1 100644
@@ -325,7 +325,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth)
 
 static int synth_probe(struct spk_synth *synth)
 {
-		unsigned int port_val = 0;
+	unsigned int port_val = 0;
 	int i = 0;
 	struct synth_settings *sp;
 
@@ -361,7 +361,8 @@ static int synth_probe(struct spk_synth *synth)
 	port_val &= 0xfbff;
 	if (port_val != 0x107f) {
 		pr_info("DoubleTalk PC: not found\n");
-		synth_release_region(synth_lpc, SYNTH_IO_EXTENT);
+		if (synth_lpc)
+			synth_release_region(synth_lpc, SYNTH_IO_EXTENT);
 		return -ENODEV;
 	}
 	while (inw_p(synth_lpc) != 0x147f)
@@ -369,7 +370,7 @@ static int synth_probe(struct spk_synth *synth)
 	sp = synth_interrogate(synth);
 	pr_info("%s: %03x-%03x, ROM ver %s, s/n %u, driver: %s\n",
 		synth->long_name, synth_lpc, synth_lpc+SYNTH_IO_EXTENT - 1,
-	 sp->rom_version, sp->serial_number, synth->version);
+		sp->rom_version, sp->serial_number, synth->version);
 	synth->alive = 1;
 	return 0;
 }
#1 lore raw
Quoted 6 lines · Alan Cox

The code bothers to probe for the device, but on failing to find it proceeds to try and release a NULL resource, thereby ruining it's prior good behaviour

Resolves-Bug: https://bugzilla.kernel.org/show_bug.cgi?id=88581

Doesn't seem to be in linux-next as of today, so I am picking it up.

Quoted 37 lines
---
 drivers/staging/speakup/speakup_dtlk.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/speakup/speakup_dtlk.c +4 -3
index d7d5152..ffd85e1 100644
@@ -325,7 +325,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth)
 
 static int synth_probe(struct spk_synth *synth)
 {
-		unsigned int port_val = 0;
+	unsigned int port_val = 0;
 	int i = 0;
 	struct synth_settings *sp;
 
@@ -361,7 +361,8 @@ static int synth_probe(struct spk_synth *synth)
 	port_val &= 0xfbff;
 	if (port_val != 0x107f) {
 		pr_info("DoubleTalk PC: not found\n");
-		synth_release_region(synth_lpc, SYNTH_IO_EXTENT);
+		if (synth_lpc)
+			synth_release_region(synth_lpc, SYNTH_IO_EXTENT);
 		return -ENODEV;
 	}
 	while (inw_p(synth_lpc) != 0x147f)
@@ -369,7 +370,7 @@ static int synth_probe(struct spk_synth *synth)
 	sp = synth_interrogate(synth);
 	pr_info("%s: %03x-%03x, ROM ver %s, s/n %u, driver: %s\n",
 		synth->long_name, synth_lpc, synth_lpc+SYNTH_IO_EXTENT - 1,
-	 sp->rom_version, sp->serial_number, synth->version);
+		sp->rom_version, sp->serial_number, synth->version);
 	synth->alive = 1;
 	return 0;
 }
Signature · 2 lines
Jiri Kosina
SUSE Labs