diff options
author | Alan Cox <alan@linux.intel.com> | 2010-04-07 19:50:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-07 19:50:00 -0400 |
commit | e31d5a05948e4478ba8396063d1e1f39880928e2 (patch) | |
tree | c164c122d3b6500b40ea9a695009215714d23ae2 | |
parent | c93f09402106f22601838ee2bb0d02bae934b5e5 (diff) |
caif: tty's are kref objects so take a reference
I don't think this can be abused in this case but do things properly.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/caif/caif_serial.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index c669ec37483b..38c0186cfbc2 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
@@ -319,7 +319,7 @@ static int ldisc_open(struct tty_struct *tty) | |||
319 | sprintf(name, "cf%s", tty->name); | 319 | sprintf(name, "cf%s", tty->name); |
320 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); | 320 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); |
321 | ser = netdev_priv(dev); | 321 | ser = netdev_priv(dev); |
322 | ser->tty = tty; | 322 | ser->tty = tty_kref_get(tty); |
323 | ser->dev = dev; | 323 | ser->dev = dev; |
324 | debugfs_init(ser, tty); | 324 | debugfs_init(ser, tty); |
325 | tty->receive_room = N_TTY_BUF_SIZE; | 325 | tty->receive_room = N_TTY_BUF_SIZE; |
@@ -352,6 +352,7 @@ static void ldisc_close(struct tty_struct *tty) | |||
352 | unregister_netdevice(ser->dev); | 352 | unregister_netdevice(ser->dev); |
353 | list_del(&ser->node); | 353 | list_del(&ser->node); |
354 | debugfs_deinit(ser); | 354 | debugfs_deinit(ser); |
355 | tty_kref_put(ser->tty); | ||
355 | if (!islocked) | 356 | if (!islocked) |
356 | rtnl_unlock(); | 357 | rtnl_unlock(); |
357 | } | 358 | } |