summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/caif/caif_serial.c3
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)
sprintf(name, "cf%s", tty->name);
dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
ser = netdev_priv(dev);
- ser->tty = tty;
+ ser->tty = tty_kref_get(tty);
ser->dev = dev;
debugfs_init(ser, tty);
tty->receive_room = N_TTY_BUF_SIZE;
@@ -352,6 +352,7 @@ static void ldisc_close(struct tty_struct *tty)
unregister_netdevice(ser->dev);
list_del(&ser->node);
debugfs_deinit(ser);
+ tty_kref_put(ser->tty);
if (!islocked)
rtnl_unlock();
}