public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial/ftdi_sio.c Fix kernel oops
@ 2013-06-07 13:14 Lotfi Manseur
  2013-06-07 13:47 ` Willy Tarreau
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Lotfi Manseur @ 2013-06-07 13:14 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Wojciech M Zabolotny, Nicolas Palix,
	Lotfi Manseur, Willy Tarreau, linux-usb, linux-kernel

Handle null termios in ftdi_set_termios(), introduced in
commit 552f6bf1bb0eda0011c0525dd587aa9e7ba5b846
This has been corrected in the mainline by
commits c515598e0f5769916c31c00392cc2bfe6af74e55 and
a816e3113b63753c330ca4751ea1d208e93e3015.

This is to be fixed in longterm 2.6.32.60 and 3.4.47.
This bug has been found with coccinelle.

Signed-off-by: Lotfi Manseur <lotfi.manseur@imag.fr>
Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
---
 drivers/usb/serial/ftdi_sio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c374beb..615bd9e 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2364,7 +2364,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
 
 	cflag = termios->c_cflag;
 
-	if (old_termios->c_cflag == termios->c_cflag
+	if (old_termios
+	    && old_termios->c_cflag == termios->c_cflag
 	    && old_termios->c_ispeed == termios->c_ispeed
 	    && old_termios->c_ospeed == termios->c_ospeed)
 		goto no_c_cflag_changes;
@@ -2373,7 +2374,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
 	   ftdi_sio_read_bulk_callback  - need to examine what this means -
 	   don't see any problems yet */
 
-	if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
+	if (old_termios &&
+	    (old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
 	    (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
 		goto no_data_parity_stop_changes;
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-06-17 15:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 13:14 [PATCH] USB: serial/ftdi_sio.c Fix kernel oops Lotfi Manseur
2013-06-07 13:47 ` Willy Tarreau
2013-06-07 13:56 ` Sergei Shtylyov
2013-06-07 17:30 ` Greg Kroah-Hartman
2013-06-07 18:49   ` Willy Tarreau
2013-06-10 21:03 ` Greg Kroah-Hartman
2013-06-13  3:35 ` Ben Hutchings
2013-06-17 15:30   ` Nicolas Palix

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