i2c: imx: Cancel hrtimer before clearing slave pointer
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f7414cd6923fd7f78e57086fc964ba2dc25db5c1 · < dab4762ee7f3fd0a01980d5407ba48d0261d3bff| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
i2c: imx: Cancel hrtimer before clearing slave pointer
In i2c_imx_unreg_slave(), the slave pointer is set to NULL after disabling interrupts. However, a pending interrupt might already have started the hrtimer (i2c_imx_slave_timeout) before the pointer was cleared. If the hrtimer fires after i2c_imx->slave is set to NULL, the timer callback i2c_imx_slave_finish_op() will call i2c_imx_slave_event() with a NULL slave pointer, which results in a use-after-free / NULL pointer dereference.
Fix by canceling the hrtimer and waiting for it to complete after disabling interrupts, before clearing the slave pointer.
From the CVE record · Linux
A race in Linux kernel i2c imx slave unregistration can leave a timer callback using a cleared slave pointer, resulting in a use-after-free or NULL pointer dereference. The input does not specify how an attacker could trigger the race or whether network access, authentication, or user interaction is required.
Engineers running Linux kernels with the i2c imx driver should check their kernel version; affected versions are not specified.