Skip to content

Commit

Permalink
USB: f81232: fix device initialisation at open
Browse files Browse the repository at this point in the history
Do not use uninitialised termios data to determine when to configure the
device at open.

This also prevents stack data from leaking to userspace.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Jun 10, 2013
1 parent 317ddd2 commit 2188672
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/usb/serial/f81232.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,12 @@ static void f81232_set_termios(struct tty_struct *tty,
/* FIXME - Stubbed out for now */

/* Don't change anything if nothing has changed */
if (!tty_termios_hw_change(&tty->termios, old_termios))
if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
return;

/* Do the real work here... */
tty_termios_copy_hw(&tty->termios, old_termios);
if (old_termios)
tty_termios_copy_hw(&tty->termios, old_termios);
}

static int f81232_tiocmget(struct tty_struct *tty)
Expand All @@ -187,12 +188,11 @@ static int f81232_tiocmset(struct tty_struct *tty,

static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct ktermios tmp_termios;
int result;

/* Setup termios */
if (tty)
f81232_set_termios(tty, port, &tmp_termios);
f81232_set_termios(tty, port, NULL);

result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
if (result) {
Expand Down

0 comments on commit 2188672

Please sign in to comment.