Re: [PATCH v2] iio: gyro: mpu3050: add missing trigger cleanup on remove

From: Dingisoul

Date: Thu Oct 15 2026 - 16:36:19 EST


Hi Joshua,

v2 looks correct -- mpu3050->trig/mpu3050->irq are now only ever set
together after iio_trigger_register() succeeds, so the unregister/
free_irq guards in the error path and mpu3050_common_remove() can
never fire on a trigger or IRQ that was never actually acquired.

Applied it, rebuilt, and reran my reproducer: the trigger now gets
properly unregistered on unbind, so the attack just gets -EINVAL
instead of a UAF. No KASAN report, no warnings.

Tested-by: Dingisoul <dingiso.kernel@xxxxxxxxx>

Best,
Dingisoul