media: i2c: ov7740: fix use-after-destroy in remove
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 39c5c4471b8d793daf868bd004e56ed420e89707 · < af81f35e4f429e769b784754e1aa4d7a922470ac| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
media: i2c: ov7740: fix use-after-destroy in remove
The ov7740_remove() function had a severe teardown order bug where it destroyed the driver's mutex before freeing the V4L2 control handler which relies on that mutex, leading to a use-after-destroy kernel panic. Furthermore, the driver explicitly called v4l2_ctrl_handler_free() and mutex_destroy() sequentially, but then called ov7740_free_controls() which invokes both of them a second time, resulting in a double-free.
This patch fixes the issue by unregistering the subdevice first, and relying exclusively on ov7740_free_controls() to safely tear down the mutex and control handler in the correct order.
From the CVE record · Linux
The Linux kernel ov7740 driver tears down a mutex before freeing a control handler that uses it, and also frees both twice. Removing the driver can cause a kernel panic; the input does not specify how an attacker could trigger removal or whether authentication or user interaction is required.
Teams running Linux kernels with the ov7740 driver should check their exposure; affected versions were not provided.