Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e31d5a05 authored by Alan Cox's avatar Alan Cox Committed by David S. Miller
Browse files

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: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c93f0940
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
}