* [PATCH 1/1] Char: nozomi, fix tty->count counting
@ 2010-07-29 9:09 Jiri Slaby
2010-07-29 9:13 ` Jiri Slaby
2010-07-29 9:46 ` [PATCH 1/1] Char: nozomi, set tty->driver_data appropriately Jiri Slaby
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2010-07-29 9:09 UTC (permalink / raw)
To: gregkh; +Cc: jirislaby, linux-kernel, Jiri Slaby, Alan Cox
Currently ntty_install omits to increment tty count and we get the
following warnings:
Warning: dev (noz2) tty->count(0) != #fd's(1) in tty_open
So to fix that, add one tty->count++ there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
---
drivers/char/nozomi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index d578449..7f9b858 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -1611,6 +1611,7 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
ret = tty_init_termios(tty);
if (ret == 0) {
tty_driver_kref_get(driver);
+ tty->count++;
driver->ttys[tty->index] = tty;
}
return ret;
--
1.7.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Char: nozomi, fix tty->count counting
2010-07-29 9:09 [PATCH 1/1] Char: nozomi, fix tty->count counting Jiri Slaby
@ 2010-07-29 9:13 ` Jiri Slaby
2010-07-29 9:46 ` [PATCH 1/1] Char: nozomi, set tty->driver_data appropriately Jiri Slaby
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2010-07-29 9:13 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, linux-kernel, Alan Cox s, stable
On 07/29/2010 11:09 AM, Jiri Slaby wrote:
> Currently ntty_install omits to increment tty count and we get the
> following warnings:
> Warning: dev (noz2) tty->count(0) != #fd's(1) in tty_open
>
> So to fix that, add one tty->count++ there.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Alan Cox <alan@linux.intel.com>
BTW introduced in 266794eb7 (nozomi: Add tty_port usage) which is in
.34. So may be a stable material too...
> ---
> drivers/char/nozomi.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
> index d578449..7f9b858 100644
> --- a/drivers/char/nozomi.c
> +++ b/drivers/char/nozomi.c
> @@ -1611,6 +1611,7 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
> ret = tty_init_termios(tty);
> if (ret == 0) {
> tty_driver_kref_get(driver);
> + tty->count++;
> driver->ttys[tty->index] = tty;
> }
> return ret;
thanks,
--
js
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] Char: nozomi, set tty->driver_data appropriately
2010-07-29 9:09 [PATCH 1/1] Char: nozomi, fix tty->count counting Jiri Slaby
2010-07-29 9:13 ` Jiri Slaby
@ 2010-07-29 9:46 ` Jiri Slaby
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2010-07-29 9:46 UTC (permalink / raw)
To: gregkh; +Cc: jirislaby, linux-kernel, Jiri Slaby, Alan Cox
Sorry, one more fix, this one depends on the other, so this is rather 2/2.
--
tty->driver_data is used all over the code, but never set. This
results in oopses like:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000130
IP: [<ffffffff814a0040>] mutex_lock+0x10/0x40
...
Pid: 2157, comm: modem-manager Not tainted 2.6.34.1-0.1-desktop #1 2768DR7/2768DR7
RIP: 0010:[<ffffffff814a0040>] [<ffffffff814a0040>] mutex_lock+0x10/0x40
RSP: 0018:ffff88007b16fa50 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000130 RCX: 0000000000000003
RDX: 0000000000000003 RSI: 0000000000000286 RDI: 0000000000000130
RBP: 0000000000001000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000130
R13: 0000000000000001 R14: 0000000000000000 R15: ffff88007b16feb4
...
Call Trace:
[<ffffffffa077690d>] ntty_write_room+0x4d/0x90 [nozomi]
...
Set tty->driver_data to the computed port in .install to not recompute it in
every place where needed. Switch .open to use driver_data too.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
---
drivers/char/nozomi.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 7f9b858..817169c 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -1612,6 +1612,7 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
if (ret == 0) {
tty_driver_kref_get(driver);
tty->count++;
+ tty->driver_data = port;
driver->ttys[tty->index] = tty;
}
return ret;
@@ -1640,7 +1641,7 @@ static int ntty_activate(struct tty_port *tport, struct tty_struct *tty)
static int ntty_open(struct tty_struct *tty, struct file *filp)
{
- struct port *port = get_port_by_tty(tty);
+ struct port *port = tty->driver_data;
return tty_port_open(&port->port, tty, filp);
}
--
1.7.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-29 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 9:09 [PATCH 1/1] Char: nozomi, fix tty->count counting Jiri Slaby
2010-07-29 9:13 ` Jiri Slaby
2010-07-29 9:46 ` [PATCH 1/1] Char: nozomi, set tty->driver_data appropriately Jiri Slaby
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.