Skip to contentSkip to conversation

Char: isicom, prolong tty reference holding

PATCH NAK Jiri Slaby 2 participants 6 messages Mar 16, 2009 Char and misc drivers

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 Char: isicom, prolong tty reference holding

Hold the tty reference a bit longer in isicom_shutdown_port, because we use it later in the function, so that it won't disappear in the meantime.

---
 drivers/char/isicom.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/char/isicom.c +1 -2
index 24aa6e8..855f375 100644
@@ -897,8 +897,6 @@ static void isicom_shutdown_port(struct isi_port *port)
 
 	tty_port_free_xmit_buf(&port->port);
 	port->port.flags &= ~ASYNC_INITIALIZED;
-	/* 3rd October 2000 : Vinayak P Risbud */
-	tty_port_tty_set(&port->port, NULL);
 
 	/*Fix done by Anil .S on 30-04-2001
 	remote login through isi port has dtr toggle problem
@@ -925,6 +923,7 @@ static void isicom_shutdown_port(struct isi_port *port)
 		if (!card->count)
 			isicom_shutdown_board(card);
 	}
+	tty_port_tty_set(&port->port, NULL);
 }
 
 static void isicom_flush_buffer(struct tty_struct *tty)
Signature · 1 line
1.6.2
author
#1 lore raw

PATCH 2/2 Char: isicom, fix build warning

Fix this:
isicom.c: In function `isicom_probe':
isicom.c:1587: warning: `signature' may be used uninitialized in this function by uninitialized_var(), because if the signature is not initialized in reset_card(), we won't use it.

---
 drivers/char/isicom.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/isicom.c +1 -1
index 855f375..2be72e6 100644
@@ -1584,7 +1584,7 @@ static unsigned int card_count;
 static int __devinit isicom_probe(struct pci_dev *pdev,
 	const struct pci_device_id *ent)
 {
-	unsigned int signature, index;
+	unsigned int uninitialized_var(signature), index;
 	int retval = -EPERM;
 	struct isi_board *board = NULL;
 
Signature · 1 line
1.6.2
#2 lore raw
In reply to Jiri Slaby
Quoted 3 lines · On Mon, 16 Mar 2009 11:34:24 +0100 Jiri Slaby <[email protected]> wrote:

Hold the tty reference a bit longer in isicom_shutdown_port, because we use it later in the function, so that it won't disappear in the meantime.

NAK - we do have a bug there but I don't think that is it.

The tty_kref_get takes an additional reference so the tty_port_tty_set is fine, but we don't then drop the kref we took temporarily. I think we need this:

isicom: isicom kref leak fix

From: Alan Cox <[email protected]>

The isicom driver leaks a kref on the shutdown path. Drop the additional kref we took

---

 drivers/char/isicom.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/isicom.c +1 -0
index 24aa6e8..a59eac5 100644
@@ -925,6 +925,7 @@ static void isicom_shutdown_port(struct isi_port *port)
 		if (!card->count)
 			isicom_shutdown_board(card);
 	}
+	tty_kref_put(tty);
 }
 
 static void isicom_flush_buffer(struct tty_struct *tty)
author
#3 lore raw
Quoted 7 lines · Alan Cox
Quoted 3 lines · On Mon, 16 Mar 2009 11:34:24 +0100 Jiri Slaby<[email protected]> wrote:

Hold the tty reference a bit longer in isicom_shutdown_port, because we use it later in the function, so that it won't disappear in the meantime.

Quoted 5 lines

NAK - we do have a bug there but I don't think that is it.

The tty_kref_get takes an additional reference so the tty_port_tty_set is fine, but we don't then drop the kref we took temporarily. I think we need this:

Hmm, but the tty_port_tty_set drops the reference, right?

author
#4 lore raw
Quoted 1 line · Jiri Slaby

Hmm, but the tty_port_tty_set drops the reference, right?

I see it. Ignore this.