staging: most: video: avoid double free on video register failure
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ eab231c0398a91fbd294672bfe9e0ff45b368246 · < 43078449ad6236d839e4d707954d2e36b10a6706| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
staging: most: video: avoid double free on video register failure
comp_register_videodev() allocates a video_device with video_device_alloc() and releases it if video_register_device() fails.
This can double free the video_device when __video_register_device() reaches device_register() and that call fails:
video_register_device() -> __video_register_device() -> device_register() fails -> put_device(&vdev->dev) -> v4l2_device_release() -> vdev->release(vdev) -> video_device_release(vdev)
comp_register_videodev() -> video_device_release(mdev->vdev)
Use video_device_release_empty() while registering the device so that registration failure paths do not free mdev->vdev through vdev->release(). comp_register_videodev() then releases mdev->vdev exactly once on failure. Restore video_device_release() after successful registration so the registered device keeps its normal lifetime handling.
This issue was found by a static analysis tool I am developing.
From the CVE record · Linux
The Linux kernel’s staging most video component can double free a video_device if device registration fails. The input does not establish whether an attacker can trigger the failure or specify any access, authentication, or user-interaction requirements.
Engineers running Linux kernels with the staging most video component should check their kernel versions; affected versions are not specified.