{"id":"CVE-2026-142985","summary":"usb: gadget: u_serial: fix NULL deref in gs_close() after failed open","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: u_serial: fix NULL deref in gs_close() after failed open\n\ngs_close() opens with\n\n\tstruct gs_port *port = tty-\u003edriver_data;\n\t...\n\tspin_lock_irq(&port-\u003eport_lock);\n\nand never checks port.  gs_open() assigns tty-\u003edriver_data only on the\nport.count 0 -\u003e 1 edge, so any failure earlier in gs_open() leaves it NULL,\nand tty_open() calls tty_release(), and hence -\u003eclose(), when -\u003eopen()\nfails.\n\nsyzbot hit exactly this on arm64.  Fault injection failed the kfifo_alloc()\nof the write buffer in gs_open():\n\n   __kfifo_alloc_node+0x10c/0x208 lib/kfifo.c:44\n   gs_open+0x144/0x514 drivers/usb/gadget/function/u_serial.c:636\n   tty_open+0x404/0x89c drivers/tty/tty_io.c:2137\n\nand the tty core's close of the failed open then took port_lock through\nthe NULL port:\n\n  BUG: unable to handle kernel paging request in gs_close\n  KASAN: null-ptr-deref in range [0x00000000000003a0-0x00000000000003a7]\n  Call trace:\n   spin_lock_irq include/linux/spinlock.h:372 [inline]\n   gs_close+0xac/0x65c drivers/usb/gadget/function/u_serial.c:698\n   tty_release+0x2c4/0xffc drivers/tty/tty_io.c:1745\n   tty_open+0x46c/0x89c drivers/tty/tty_io.c:2146\n\nReturn early instead.  There is nothing to release when the open never got\nfar enough to claim the port.\n\nUnlike the check reverted by commit f6c7bc4a6823 (\"Revert \"usb: gadget:\nu_serial: Add null pointer check in gs_start_io\"\"), this is not hiding a\nrace: the tty core calls -\u003eclose() for an -\u003eopen() that failed by design,\nso driver_data is legitimately unset on that path.","modified":"2026-12-03T11:00:19.902173177Z","published":"2026-12-03T09:17:16.423Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142985.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/63b69946c0de838af7324a504766fa13ad947d3d"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ce8c7b4b562aa7c3847145dc2e3a2d0953a054b2"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d010585071193e268c4152df2b3281255280529b"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ea6cf69ad03c8d85138830c0d2c3b946b5ae231d"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ea6e4e3a7c8453674337c7773cf3b101f328c876"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ece1756e054ffcb38a8aab7d0ab7d0e02e65dd99"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142985.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-142985"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"c1dca562be8ada614ef193aa246c6f8705bcd6b9"},{"fixed":"ece1756e054ffcb38a8aab7d0ab7d0e02e65dd99"},{"fixed":"ce8c7b4b562aa7c3847145dc2e3a2d0953a054b2"},{"fixed":"63b69946c0de838af7324a504766fa13ad947d3d"},{"fixed":"ea6e4e3a7c8453674337c7773cf3b101f328c876"},{"fixed":"d010585071193e268c4152df2b3281255280529b"},{"fixed":"ea6cf69ad03c8d85138830c0d2c3b946b5ae231d"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-142985.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.27"},{"fixed":"5.10.276"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.227"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-142985.json"}}],"schema_version":"1.9.2"}