CVE-2024-40966 addresses a vulnerability in the Linux kernel's tty subsystem where a new line discipline (ldisc) could cause a kernel BUG due to improper sleeping context. The fix adds an option to reject new ldisc attachments on tty devices, limiting virtual terminals to only the N_TTY line discipline. This prevents the con_write() routine from being called in an invalid context, which previously led to a BUG triggered by sleeping functions called while holding a spinlock.