Skip to contentSkip to conversation

staging: speakup: fix tty-operation NULL derefs

PATCH In review Johan Hovold 2 participants 2 messages Jan 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: speakup: fix tty-operation NULL derefs

The send_xchar() and tiocmset() tty operations are optional. Add the missing sanity checks to prevent user-space triggerable NULL-pointer dereferences.

Fixes 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input functionality for tty")
Cc stable <[email protected]> # 4.13
Cc Okash Khawaja <[email protected]>
Cc Samuel Thibault <[email protected]>
---
 drivers/staging/speakup/spk_ttyio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/speakup/spk_ttyio.c +4 -2
index c92bbd05516e..005de0024dd4 100644
@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
 		return;
 	}
 
-	speakup_tty->ops->send_xchar(speakup_tty, ch);
+	if (speakup_tty->ops->send_xchar)
+		speakup_tty->ops->send_xchar(speakup_tty, ch);
 	mutex_unlock(&speakup_tty_mutex);
 }
 
@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
 		return;
 	}
 
-	speakup_tty->ops->tiocmset(speakup_tty, set, clear);
+	if (speakup_tty->ops->tiocmset)
+		speakup_tty->ops->tiocmset(speakup_tty, set, clear);
 	mutex_unlock(&speakup_tty_mutex);
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Johan Hovold, le mer. 30 janv. 2019 10:49:34 +0100, a ecrit:

Quoted 9 lines

The send_xchar() and tiocmset() tty operations are optional. Add the missing sanity checks to prevent user-space triggerable NULL-pointer dereferences.

Fixes 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input functionality for tty")
Cc stable <[email protected]> # 4.13
Cc Okash Khawaja <[email protected]>
Cc Samuel Thibault <[email protected]>

Indeed.

Quoted 31 lines
---
 drivers/staging/speakup/spk_ttyio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/speakup/spk_ttyio.c +4 -2
index c92bbd05516e..005de0024dd4 100644
@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
 		return;
 	}
 
-	speakup_tty->ops->send_xchar(speakup_tty, ch);
+	if (speakup_tty->ops->send_xchar)
+		speakup_tty->ops->send_xchar(speakup_tty, ch);
 	mutex_unlock(&speakup_tty_mutex);
 }
 
@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
 		return;
 	}
 
-	speakup_tty->ops->tiocmset(speakup_tty, set, clear);
+	if (speakup_tty->ops->tiocmset)
+		speakup_tty->ops->tiocmset(speakup_tty, set, clear);
 	mutex_unlock(&speakup_tty_mutex);
 }
 
Signature · 1 line
2.20.1
Signature · 5 lines
Samuel
R: Parce que ça renverse bêtement l'ordre naturel de lecture!
Q: Mais pourquoi citer en fin d'article est-il si effroyable?
R: Citer en fin d'article
Q: Quelle est la chose la plus désagréable sur les groupes de news?