linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: greg@kroah.com, linux-serial@vger.kernel.org
Subject: [PATCH 01/11] tty: Fix the digi acceleport driver NULL checks
Date: Wed, 19 May 2010 13:01:56 +0100	[thread overview]
Message-ID: <20100519120148.16717.1135.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100519120111.16717.71992.stgit@localhost.localdomain>

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

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/usb/serial/digi_acceleport.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 3edda3e..2d28c02 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -609,8 +609,10 @@ static void digi_wakeup_write_lock(struct work_struct *work)
 static void digi_wakeup_write(struct usb_serial_port *port)
 {
 	struct tty_struct *tty = tty_port_tty_get(&port->port);
-	tty_wakeup(tty);
-	tty_kref_put(tty);
+	if (tty) {
+		tty_wakeup(tty);
+		tty_kref_put(tty);
+	}
 }
 
 
@@ -1683,7 +1685,7 @@ static int digi_read_inb_callback(struct urb *urb)
 		priv->dp_throttle_restart = 1;
 
 	/* receive data */
-	if (opcode == DIGI_CMD_RECEIVE_DATA) {
+	if (tty && opcode == DIGI_CMD_RECEIVE_DATA) {
 		/* get flag from port_status */
 		flag = 0;
 
@@ -1764,10 +1766,12 @@ static int digi_read_oob_callback(struct urb *urb)
 			return -1;
 
 		tty = tty_port_tty_get(&port->port);
+
 		rts = 0;
-		rts = tty->termios->c_cflag & CRTSCTS;
+		if (tty)
+			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);
 			/* convert from digi flags to termiox flags */
 			if (val & DIGI_READ_INPUT_SIGNALS_CTS) {


  reply	other threads:[~2010-05-19 12:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 12:01 [PATCH 00/11] BKL pruning and serial bug fixing Alan Cox
2010-05-19 12:01 ` Alan Cox [this message]
2010-05-19 12:02 ` [PATCH 02/11] stallion: prune lock_kernel calls Alan Cox
2010-05-19 12:02 ` [PATCH 03/11] istallion: use bit ops for the board flags Alan Cox
2010-05-19 12:02 ` [PATCH 04/11] riscom8: kill use of lock_kernel Alan Cox
2010-05-19 12:02 ` [PATCH 05/11] isicom: kill off the BKL Alan Cox
2010-05-19 12:02 ` [PATCH 06/11] rocket: kill BKL Alan Cox
2010-05-19 12:02 ` [PATCH 07/11] synclink: kill the big kernel lock Alan Cox
2010-05-19 12:03 ` [PATCH 08/11] cyclades: Kill off BKL usage Alan Cox
2010-05-19 12:03 ` [PATCH 09/11] epca: Kill the big kernel lock Alan Cox
2010-05-19 12:03 ` [PATCH 10/11] specialix; Kill the BKL Alan Cox
2010-05-19 12:03 ` [PATCH 11/11] synclink: reworking locking a bit Alan Cox
2010-05-20 17:56 ` [PATCH 00/11] BKL pruning and serial bug fixing Greg KH
2010-05-20 18:06   ` Alan Cox
2010-05-20 19:01     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100519120148.16717.1135.stgit@localhost.localdomain \
    --to=alan@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).