{"id":"CVE-2026-31576","summary":"media: hackrf: fix to not free memory after the device is registered in hackrf_probe()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: hackrf: fix to not free memory after the device is registered in hackrf_probe()\n\nIn hackrf driver, the following race condition occurs:\n```\n\t\tCPU0\t\t\t\t\t\tCPU1\nhackrf_probe()\n  kzalloc(); // alloc hackrf_dev\n  ....\n  v4l2_device_register();\n  ....\n\t\t\t\t\t\tfd = sys_open(\"/path/to/dev\"); // open hackrf fd\n\t\t\t\t\t\t....\n  v4l2_device_unregister();\n  ....\n  kfree(); // free hackrf_dev\n  ....\n\t\t\t\t\t\tsys_ioctl(fd, ...);\n\t\t\t\t\t\t  v4l2_ioctl();\n\t\t\t\t\t\t    video_is_registered() // UAF!!\n\t\t\t\t\t\t....\n\t\t\t\t\t\tsys_close(fd);\n\t\t\t\t\t\t  v4l2_release() // UAF!!\n\t\t\t\t\t\t    hackrf_video_release()\n\t\t\t\t\t\t      kfree(); // DFB!!\n```\n\nWhen a V4L2 or video device is unregistered, the device node is removed so\nnew open() calls are blocked.\n\nHowever, file descriptors that are already open-and any in-flight I/O-do\nnot terminate immediately; they remain valid until the last reference is\ndropped and the driver's release() is invoked.\n\nTherefore, freeing device memory on the error path after hackrf_probe()\nhas registered dev it will lead to a race to use-after-free vuln, since\nthose already-open handles haven't been released yet.\n\nAnd since release() free memory too, race to use-after-free and\ndouble-free vuln occur.\n\nTo prevent this, if device is registered from probe(), it should be\nmodified to free memory only through release() rather than calling\nkfree() directly.","modified":"2026-06-03T03:54:30.040005189Z","published":"2026-04-24T14:42:08.188Z","related":["CGA-hwhc-rjv4-h7fp","openSUSE-SU-2026:10703-1"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31576.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/07e9e674b6146b1f6fc41b1f54b8968bf2802824"},{"type":"WEB","url":"https://git.kernel.org/stable/c/131ec9046e1c8af101aebdaec4e8095e05f3312b"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2145c71a8044362e82e9923f001ba2aeb771b848"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3b7da2b4d0fe014eff181ed37e3bf832eb8ed258"},{"type":"WEB","url":"https://git.kernel.org/stable/c/45cbaf5c7cdc5386d86377f0daf94a17a007fed0"},{"type":"WEB","url":"https://git.kernel.org/stable/c/67fd62e3efdc9dce01f76d95a745212f4feb38e6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/87b9685cca91ed715c39ba544715832d26a7f4b4"},{"type":"WEB","url":"https://git.kernel.org/stable/c/98a0a81ce78020c2522e0046f49d200de9778cb9"},{"type":"WEB","url":"https://git.kernel.org/stable/c/fcd1d70792a35c8a97414fe429f48311e41269c2"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31576.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31576"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd"},{"fixed":"87b9685cca91ed715c39ba544715832d26a7f4b4"},{"fixed":"131ec9046e1c8af101aebdaec4e8095e05f3312b"},{"fixed":"67fd62e3efdc9dce01f76d95a745212f4feb38e6"},{"fixed":"45cbaf5c7cdc5386d86377f0daf94a17a007fed0"},{"fixed":"98a0a81ce78020c2522e0046f49d200de9778cb9"},{"fixed":"07e9e674b6146b1f6fc41b1f54b8968bf2802824"},{"fixed":"2145c71a8044362e82e9923f001ba2aeb771b848"},{"fixed":"fcd1d70792a35c8a97414fe429f48311e41269c2"},{"fixed":"3b7da2b4d0fe014eff181ed37e3bf832eb8ed258"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31576.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.4.0"},{"fixed":"5.10.258"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.209"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.175"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.136"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.83"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.24"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"6.19.14"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.20.0"},{"fixed":"7.0.1"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31576.json"}}],"schema_version":"1.7.5"}