CVE-2026-89901: media: airspy: use vb2_video_unregister_device() on disconnect to fix NULL deref
In the Linux kernel, the following vulnerability has been resolved:
media: airspy: use vb2videounregisterdevice() on disconnect to fix NULL deref
airspydisconnect() clears s->udev under v4l2lock, but airspystopstreaming() unconditionally calls airspyctrlmsg() and airspyfreestreambufs() afterwards. If a streaming user closes the device after disconnect, stopstreaming() runs and dereferences the NULL s->udev:
airspystopstreaming() airspyctrlmsg(s, CMDRECEIVERMODE, 0, 0, NULL, 0) usbsndctrlpipe(s->udev, 0) / NULL deref / airspyfreestreambufs(s) usbfreecoherent(s->udev, ...) / NULL deref /
The airspy driver uses vb2foprelease() in its fileoperations, so replace videounregisterdevice(&s->vdev) with vb2videounregisterdevice(&s->vdev) and move it before clearing s->udev. vb2videounregisterdevice() releases the vb2 queue, which synchronously runs airspystopstreaming() if streaming is active, so the URBs, coherent DMA stream buffers and the hardware stop control message all execute while s->udev is still valid.
vb2videounregisterdevice() locks vdev->queue->lock (vbqueuelock) internally, and stopstreaming() locks v4l2lock, so the previous outer mutexlock(&s->vbqueuelock) / mutexlock(&s->v4l2lock) pair around the unregister sequence would self-deadlock and has been removed. A short v4l2lock critical section around s->udev = NULL remains so any ioctl path that still holds the file descriptor sees coherent state.
Issue identified by automated review of the INV-003 series at https://sashiko.dev/
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Replace the airspy disconnect unregister logic to call vb2_video_unregister_device(&s->vdev) before clearing s->udev (i.e., move vb2_video_unregister_device() ahead of s->udev = NULL). Use a short v4l2_lock critical section only for s->udev = NULL, while keeping the unregister sequence coherent so stop_streaming() does not dereference NULL.
media: airspy (v4l2/ vb2 disconnect path) disconnect sequence for device unregister = Use vb2_video_unregister_device() on disconnect and unregister before clearing s->udev
Event History
Frequently Asked Questions
What conditions are required to trigger the NULL dereference?
An Airspy device must be disconnected while streaming is active, followed by a streaming user closing the device. The close path then runs the stream-stop routine after the USB device pointer has been cleared.
Which systems are exposed to this issue?
Systems using the Linux kernel Airspy media driver are exposed when they have an Airspy device in use with active streaming. The issue is tied to device disconnect handling rather than normal streaming alone.
What observable behavior may indicate the system has encountered this issue?
A NULL-pointer dereference can occur during the stream shutdown path after an Airspy USB disconnect. The failing operations include sending the receiver-stop control message and freeing coherent DMA stream buffers through the cleared USB device pointer.
How does the resolved change prevent the failure?
The corrected disconnect path unregisters the video device through the vb2-specific unregister function before clearing the USB device pointer. This synchronously stops active streaming and releases URBs and DMA buffers while the USB device pointer remains valid.