{"id":"CVE-2026-31576","aliases":["CVE-2026-31576"],"related":[],"kind":"vulnerability","state":"published","title":"media: hackrf: fix to not free memory after the device is registered in hackrf_probe()","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nmedia: hackrf: corrección para no liberar memoria después de que el dispositivo es registrado en hackrf_probe()\n\nEn el controlador hackrf, la siguiente condición de carrera ocurre:\n””“\n\t\tCPU0\t\t\t\t\t\tCPU1\nhackrf_probe()\n  kzalloc(); // asigna hackrf_dev\n  ....\n  v4l2_device_register();\n  ....\n\t\t\t\t\t\tfd = sys_open(“/path/to/dev”); // abre el descriptor de archivo hackrf\n\t\t\t\t\t\t....\n  v4l2_device_unregister();\n  ....\n  kfree(); // libera 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\nCuando un dispositivo V4L2 o de video es dado de baja, el nodo del dispositivo es eliminado, por lo que las nuevas llamadas a open() son bloqueadas.\n\nSin embargo, los descriptores de archivo que ya están abiertos -y cualquier E/S en curso- no terminan inmediatamente; permanecen válidos hasta que la última referencia es liberada y se invoca el release() del controlador.\n\nPor lo tanto, liberar la memoria del dispositivo en la ruta de error después de que hackrf_probe() ha registrado el dispositivo conducirá a una condición de carrera de vulnerabilidad de uso después de liberación, ya que esos manejadores ya abiertos aún no han sido liberados.\n\nY dado que release() también libera memoria, ocurren una condición de carrera de uso después de liberación y una vulnerabilidad de doble liberación.\n\nPara evitar esto, si el dispositivo es registrado desde probe(), debería modificarse para liberar memoria solo a través de release() en lugar de llamar a kfree() directamente.","source":"nvd"}],"published":"2026-04-24T14:42:08.188Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"87b9685cca91ed715c39ba544715832d26a7f4b4","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"131ec9046e1c8af101aebdaec4e8095e05f3312b","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"67fd62e3efdc9dce01f76d95a745212f4feb38e6","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"45cbaf5c7cdc5386d86377f0daf94a17a007fed0","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"98a0a81ce78020c2522e0046f49d200de9778cb9","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"07e9e674b6146b1f6fc41b1f54b8968bf2802824","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"2145c71a8044362e82e9923f001ba2aeb771b848","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"fcd1d70792a35c8a97414fe429f48311e41269c2","status":"affected"},{"type":"git","introduced":"8bc4a9ed85046c214458c9e82aea75d2f46cfffd","fixed":"3b7da2b4d0fe014eff181ed37e3bf832eb8ed258","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.4","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.4","status":"unaffected"},{"type":"semver","introduced":"5.10.258","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.209","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.175","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.136","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.83","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.24","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.14","lastAffected":"6.19.*","status":"unaffected"},{"type":"semver","introduced":"7.0.1","lastAffected":"7.0.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","fixed":"6.6.136"},{"status":"affected","introduced":"6.7","fixed":"6.12.83"},{"status":"affected","introduced":"6.13","fixed":"6.18.24"},{"status":"affected","introduced":"6.19","fixed":"6.19.14"},{"status":"affected","introduced":"7.0","fixed":"7.0.1"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/87b9685cca91ed715c39ba544715832d26a7f4b4","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/131ec9046e1c8af101aebdaec4e8095e05f3312b","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/67fd62e3efdc9dce01f76d95a745212f4feb38e6","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/45cbaf5c7cdc5386d86377f0daf94a17a007fed0","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/98a0a81ce78020c2522e0046f49d200de9778cb9","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/07e9e674b6146b1f6fc41b1f54b8968bf2802824","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2145c71a8044362e82e9923f001ba2aeb771b848","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/fcd1d70792a35c8a97414fe429f48311e41269c2","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3b7da2b4d0fe014eff181ed37e3bf832eb8ed258","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31576","url":"https://www.cve.org/CVERecord?id=CVE-2026-31576","licence":"CVE Terms of Use","modified":"2026-06-14T17:42:00.110Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31576","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31576","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"}],"updatedAt":"2026-11-25T22:59:19.492Z","epss":{"score":0.00133,"percentile":0.03028,"date":"2026-12-01T12:00:22.000Z"}}