2009-03-16 15:48:41

by Jan Kasprzak

[permalink] [raw]
Subject: [PATCH] drivers/char/mxser.c: Fix reference counting

Hello,

In drivers/char/mxser.c:mxser_check_modem_status() there is a call
to tty_port_tty_get without a corresponding tty_put() call. This causes
the device to return -EIO on the second open(2) call.

Signed-off-by: Jan "Yenya" Kasprzak <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Alan Cox <[email protected]>
---
drivers/char/mxser.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 402c9f2..de6f565 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -848,6 +848,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
}
}
}
+ tty_kref_put(tty);
}

static int mxser_startup(struct tty_struct *tty)
--
1.5.3.3

--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/ Journal: http://www.fi.muni.cz/~kas/blog/ |
>> If you find yourself arguing with Alan Cox, you’re _probably_ wrong. <<
>> --James Morris in "How and Why You Should Become a Kernel Hacker" <<


2009-03-16 16:02:15

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH] drivers/char/mxser.c: Fix reference counting

On 16.3.2009 16:48, Jan Kasprzak wrote:
> In drivers/char/mxser.c:mxser_check_modem_status() there is a call
> to tty_port_tty_get without a corresponding tty_put() call. This causes
> the device to return -EIO on the second open(2) call.

I was faster :P:
http://lkml.org/lkml/2009/3/16/159

2009-03-16 16:04:20

by Jan Kasprzak

[permalink] [raw]
Subject: Re: [PATCH] drivers/char/mxser.c: Fix reference counting

Jiri Slaby wrote:
: On 16.3.2009 16:48, Jan Kasprzak wrote:
: >In drivers/char/mxser.c:mxser_check_modem_status() there is a call
: >to tty_port_tty_get without a corresponding tty_put() call. This causes
: >the device to return -EIO on the second open(2) call.
:
: I was faster :P:
: http://lkml.org/lkml/2009/3/16/159

OK, sorry for not checking out lkml first :-)

-Yenya

--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/ Journal: http://www.fi.muni.cz/~kas/blog/ |
>> If you find yourself arguing with Alan Cox, you’re _probably_ wrong. <<
>> --James Morris in "How and Why You Should Become a Kernel Hacker" <<