提交 e31d5a05 编写于 作者: A Alan Cox 提交者: David S. Miller

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: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c93f0940
...@@ -319,7 +319,7 @@ static int ldisc_open(struct tty_struct *tty) ...@@ -319,7 +319,7 @@ static int ldisc_open(struct tty_struct *tty)
sprintf(name, "cf%s", tty->name); sprintf(name, "cf%s", tty->name);
dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
ser = netdev_priv(dev); ser = netdev_priv(dev);
ser->tty = tty; ser->tty = tty_kref_get(tty);
ser->dev = dev; ser->dev = dev;
debugfs_init(ser, tty); debugfs_init(ser, tty);
tty->receive_room = N_TTY_BUF_SIZE; tty->receive_room = N_TTY_BUF_SIZE;
...@@ -352,6 +352,7 @@ static void ldisc_close(struct tty_struct *tty) ...@@ -352,6 +352,7 @@ static void ldisc_close(struct tty_struct *tty)
unregister_netdevice(ser->dev); unregister_netdevice(ser->dev);
list_del(&ser->node); list_del(&ser->node);
debugfs_deinit(ser); debugfs_deinit(ser);
tty_kref_put(ser->tty);
if (!islocked) if (!islocked)
rtnl_unlock(); rtnl_unlock();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册