--- a/sys/kern/tty_pty.c 2026-06-29 12:51:19.000000000 +0000 +++ b/sys/kern/tty_pty.c 2026-10-26 00:25:42.773043131 +0000 @@ -718,8 +718,13 @@ if (pti->pt_send & TIOCPKT_IOCTL) { cc = (int)szmin(ap->a_uio->uio_resid, sizeof(tp->t_termios)); - uiomove((caddr_t)&tp->t_termios, cc, + error = uiomove((caddr_t)&tp->t_termios, cc, ap->a_uio); + if (error) { + lwkt_reltoken(&tp->t_token); + lwkt_reltoken(&pti->pt_tty.t_token); + return (error); + } } pti->pt_send = 0; lwkt_reltoken(&tp->t_token);