character device lifecycle

About this tag
The character device lifecycle in Linux kernel USB gadget drivers, particularly the f_hid function driver, is a critical security boundary. A vulnerability (CVE-2026-31606) arises when re-binding after an unbind reinitializes a character device that may still be in use by an open file descriptor. The fix replaces cdev_init with cdev_alloc to allow clean replacement of the device node, preventing use-after-free conditions. This tag covers discussions of proper teardown and initialization sequences for character devices in kernel drivers, emphasizing that lifecycle management must treat teardown as a security boundary to avoid exploitable race conditions.
  1. CVE-2026-31606 USB HID Gadget Fix: Teardown as a Security Boundary

    CVE-2026-31606 is a narrow-looking Linux kernel bug with a much bigger lesson than its short description suggests: teardown must be treated as a security boundary. The issue lives in the USB gadget f_hid function driver, where re-binding after an unbind could call cdev_init on a character device...