netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net, TTY: initialize tty->driver_data before usage
@ 2012-10-05  0:01 Sasha Levin
  2012-10-05  8:09 ` Jiri Slaby
  2012-10-05 16:25 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2012-10-05  0:01 UTC (permalink / raw)
  To: samuel, davem, gregkh, jslaby, alan
  Cc: levinsasha928, davej, linux-kernel, netdev, Sasha Levin

Commit 9c650ffc ("TTY: ircomm_tty, add tty install") split _open() to
_install() and _open(). It also moved the initialization of driver_data
out of open(), but never added it to install() - causing a NULL ptr
deref whenever the driver was used.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 net/irda/ircomm/ircomm_tty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 95a3a7a..496ce2c 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -421,6 +421,8 @@ static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 		hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL);
 	}
 
+	tty->driver_data = self;
+
 	return tty_port_install(&self->port, driver, tty);
 }
 
-- 
1.7.12

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

* Re: [PATCH] net, TTY: initialize tty->driver_data before usage
  2012-10-05  0:01 [PATCH] net, TTY: initialize tty->driver_data before usage Sasha Levin
@ 2012-10-05  8:09 ` Jiri Slaby
  2012-10-05 16:25 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2012-10-05  8:09 UTC (permalink / raw)
  To: Sasha Levin
  Cc: samuel, davem, gregkh, alan, levinsasha928, davej, linux-kernel,
	netdev

On 10/05/2012 02:01 AM, Sasha Levin wrote:
> Commit 9c650ffc ("TTY: ircomm_tty, add tty install") split _open() to
> _install() and _open(). It also moved the initialization of driver_data
> out of open(), but never added it to install() - causing a NULL ptr
> deref whenever the driver was used.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  net/irda/ircomm/ircomm_tty.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
> index 95a3a7a..496ce2c 100644
> --- a/net/irda/ircomm/ircomm_tty.c
> +++ b/net/irda/ircomm/ircomm_tty.c
> @@ -421,6 +421,8 @@ static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
>  		hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL);
>  	}
>  
> +	tty->driver_data = self;
> +
>  	return tty_port_install(&self->port, driver, tty);

Yes, a good catch.

Acked-by: Jiri Slaby <jslaby@suse.cz>

thanks,
-- 
js
suse labs

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

* Re: [PATCH] net, TTY: initialize tty->driver_data before usage
  2012-10-05  0:01 [PATCH] net, TTY: initialize tty->driver_data before usage Sasha Levin
  2012-10-05  8:09 ` Jiri Slaby
@ 2012-10-05 16:25 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2012-10-05 16:25 UTC (permalink / raw)
  To: Sasha Levin
  Cc: samuel, davem, jslaby, alan, levinsasha928, davej, linux-kernel,
	netdev

On Thu, Oct 04, 2012 at 08:01:21PM -0400, Sasha Levin wrote:
> Commit 9c650ffc ("TTY: ircomm_tty, add tty install") split _open() to
> _install() and _open(). It also moved the initialization of driver_data
> out of open(), but never added it to install() - causing a NULL ptr
> deref whenever the driver was used.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> Acked-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  net/irda/ircomm/ircomm_tty.c | 2 ++
>  1 file changed, 2 insertions(+)

Nice catch, now applied.

greg k-h

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

end of thread, other threads:[~2012-10-05 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05  0:01 [PATCH] net, TTY: initialize tty->driver_data before usage Sasha Levin
2012-10-05  8:09 ` Jiri Slaby
2012-10-05 16:25 ` Greg KH

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).