--- x/drivers/net/caif/caif_serial.c +++ y/drivers/net/caif/caif_serial.c @@ -306,8 +306,11 @@ static void ser_release(struct work_stru if (!list_empty(&list)) { rtnl_lock(); list_for_each_entry_safe(ser, tmp, &list, node) { + struct tty_struct *tty = ser->tty; + dev_close(ser->dev); unregister_netdevice(ser->dev); + tty_kref_put(tty); debugfs_deinit(ser); } rtnl_unlock(); @@ -369,8 +372,6 @@ static void ldisc_close(struct tty_struc { struct ser_device *ser = tty->disc_data; - tty_kref_put(ser->tty); - spin_lock(&ser_lock); list_move(&ser->node, &ser_release_list); spin_unlock(&ser_lock);