public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Char: isicom, prolong tty reference holding
@ 2009-03-16 10:34 Jiri Slaby
  2009-03-16 10:34 ` [PATCH 2/2] Char: isicom, fix build warning Jiri Slaby
  2009-03-16 10:50 ` [PATCH 1/2] Char: isicom, prolong tty reference holding Alan Cox
  0 siblings, 2 replies; 6+ messages in thread
From: Jiri Slaby @ 2009-03-16 10:34 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Jiri Slaby, Alan Cox

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.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
---
 drivers/char/isicom.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 24aa6e8..855f375 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -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)
-- 
1.6.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Char: isicom, fix build warning
  2009-03-16 10:34 [PATCH 1/2] Char: isicom, prolong tty reference holding Jiri Slaby
@ 2009-03-16 10:34 ` Jiri Slaby
  2009-03-16 10:50 ` [PATCH 1/2] Char: isicom, prolong tty reference holding Alan Cox
  1 sibling, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2009-03-16 10:34 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Jiri Slaby

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.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/char/isicom.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 855f375..2be72e6 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -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;
 
-- 
1.6.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Char: isicom, prolong tty reference holding
  2009-03-16 10:34 [PATCH 1/2] Char: isicom, prolong tty reference holding Jiri Slaby
  2009-03-16 10:34 ` [PATCH 2/2] Char: isicom, fix build warning Jiri Slaby
@ 2009-03-16 10:50 ` Alan Cox
  2009-03-16 10:56   ` Jiri Slaby
  2009-03-16 11:09   ` Jiri Slaby
  1 sibling, 2 replies; 6+ messages in thread
From: Alan Cox @ 2009-03-16 10:50 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: akpm, linux-kernel, Jiri Slaby

On Mon, 16 Mar 2009 11:34:24 +0100
Jiri Slaby <jirislaby@gmail.com> 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 <alan@lxorguk.ukuu.org.uk>

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

Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
---

 drivers/char/isicom.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 24aa6e8..a59eac5 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -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)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Char: isicom, prolong tty reference holding
  2009-03-16 10:50 ` [PATCH 1/2] Char: isicom, prolong tty reference holding Alan Cox
@ 2009-03-16 10:56   ` Jiri Slaby
  2009-03-16 10:59     ` Jiri Slaby
  2009-03-16 11:09   ` Jiri Slaby
  1 sibling, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2009-03-16 10:56 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel

On 16.3.2009 11:50, Alan Cox wrote:
> On Mon, 16 Mar 2009 11:34:24 +0100
> Jiri Slaby<jirislaby@gmail.com>  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:

Hmm, but the tty_port_tty_set drops the reference, right?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Char: isicom, prolong tty reference holding
  2009-03-16 10:56   ` Jiri Slaby
@ 2009-03-16 10:59     ` Jiri Slaby
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2009-03-16 10:59 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel

On 16.3.2009 11:56, Jiri Slaby wrote:
> Hmm, but the tty_port_tty_set drops the reference, right?

I see it. Ignore this.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Char: isicom, prolong tty reference holding
  2009-03-16 10:50 ` [PATCH 1/2] Char: isicom, prolong tty reference holding Alan Cox
  2009-03-16 10:56   ` Jiri Slaby
@ 2009-03-16 11:09   ` Jiri Slaby
  1 sibling, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2009-03-16 11:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel

On 16.3.2009 11:50, Alan Cox wrote:
> isicom: isicom kref leak fix
>
> From: Alan Cox<alan@lxorguk.ukuu.org.uk>
>
> The isicom driver leaks a kref on the shutdown path. Drop the additional
> kref we took
>
> Signed-off-by: Alan Cox<alan@lxorguk.ukuu.org.uk>

Acked-by: Jiri Slaby <jirislaby@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-16 11:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-16 10:34 [PATCH 1/2] Char: isicom, prolong tty reference holding Jiri Slaby
2009-03-16 10:34 ` [PATCH 2/2] Char: isicom, fix build warning Jiri Slaby
2009-03-16 10:50 ` [PATCH 1/2] Char: isicom, prolong tty reference holding Alan Cox
2009-03-16 10:56   ` Jiri Slaby
2009-03-16 10:59     ` Jiri Slaby
2009-03-16 11:09   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox