Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4287341d authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

tty: Fix the digi acceleport driver NULL checks



This now refcounts but doesn't actually check the reference was obtained in
all the places it should.

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7479db07
Loading
Loading
Loading
Loading
+9 −5
Original line number Original line Diff line number Diff line
@@ -609,9 +609,11 @@ static void digi_wakeup_write_lock(struct work_struct *work)
static void digi_wakeup_write(struct usb_serial_port *port)
static void digi_wakeup_write(struct usb_serial_port *port)
{
{
	struct tty_struct *tty = tty_port_tty_get(&port->port);
	struct tty_struct *tty = tty_port_tty_get(&port->port);
	if (tty) {
		tty_wakeup(tty);
		tty_wakeup(tty);
		tty_kref_put(tty);
		tty_kref_put(tty);
	}
	}
}




/*
/*
@@ -1682,7 +1684,7 @@ static int digi_read_inb_callback(struct urb *urb)
		priv->dp_throttle_restart = 1;
		priv->dp_throttle_restart = 1;


	/* receive data */
	/* receive data */
	if (opcode == DIGI_CMD_RECEIVE_DATA) {
	if (tty && opcode == DIGI_CMD_RECEIVE_DATA) {
		/* get flag from port_status */
		/* get flag from port_status */
		flag = 0;
		flag = 0;


@@ -1763,10 +1765,12 @@ static int digi_read_oob_callback(struct urb *urb)
			return -1;
			return -1;


		tty = tty_port_tty_get(&port->port);
		tty = tty_port_tty_get(&port->port);

		rts = 0;
		rts = 0;
		if (tty)
			rts = tty->termios->c_cflag & CRTSCTS;
			rts = tty->termios->c_cflag & CRTSCTS;
		
		
		if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
		if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
			spin_lock(&priv->dp_port_lock);
			spin_lock(&priv->dp_port_lock);
			/* convert from digi flags to termiox flags */
			/* convert from digi flags to termiox flags */
			if (val & DIGI_READ_INPUT_SIGNALS_CTS) {
			if (val & DIGI_READ_INPUT_SIGNALS_CTS) {