Skip to content

Commit

Permalink
Staging: serqt_usb2: add missing calls to tty_kref_put()
Browse files Browse the repository at this point in the history
tty_port_tty_get() was called without a corresponding tty_kref_put()
in qt_read_bulk_callback() and qt_close().

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Bill Pemberton authored and Greg Kroah-Hartman committed Jul 28, 2009
1 parent 4733fd3 commit f3a7568
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/staging/serqt_usb2/serqt_usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,18 @@ static void qt_read_bulk_callback(struct urb *urb)
if (port_paranoia_check(port, __func__) != 0) {
dbg("%s - port_paranoia_check, exiting\n", __func__);
qt_port->ReadBulkStopped = 1;
return;
goto exit;
}

if (!serial) {
dbg("%s - bad serial pointer, exiting\n", __func__);
return;
goto exit;
}
if (qt_port->closePending == 1) {
/* Were closing , stop reading */
dbg("%s - (qt_port->closepending == 1\n", __func__);
qt_port->ReadBulkStopped = 1;
return;
goto exit;
}

/*
Expand All @@ -381,15 +381,15 @@ static void qt_read_bulk_callback(struct urb *urb)
*/
if (qt_port->RxHolding == 1) {
qt_port->ReadBulkStopped = 1;
return;
goto exit;
}

if (urb->status) {
qt_port->ReadBulkStopped = 1;

dbg("%s - nonzero read bulk status received: %d\n",
__func__, urb->status);
return;
goto exit;
}

if (tty && RxCount) {
Expand Down Expand Up @@ -463,6 +463,8 @@ static void qt_read_bulk_callback(struct urb *urb)
}

schedule_work(&port->work);
exit:
tty_kref_put(tty);
}

/*
Expand Down Expand Up @@ -1041,7 +1043,7 @@ static void qt_block_until_empty(struct tty_struct *tty,
}
}

static void qt_close( struct usb_serial_port *port)
static void qt_close(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct quatech_port *qt_port;
Expand All @@ -1068,6 +1070,7 @@ static void qt_close( struct usb_serial_port *port)
/* wait up to for transmitter to empty */
if (serial->dev)
qt_block_until_empty(tty, qt_port);
tty_kref_put(tty);

/* Close uart channel */
status = qt_close_channel(serial, index);
Expand Down

0 comments on commit f3a7568

Please sign in to comment.