Hello Pavel, [dropped Dan Murphy from Cc:, the email address doesn't work] On Fri, May 13, 2022 at 04:02:55PM +0200, Pavel Machek wrote: > Hi! > > > The mutex might still be in use until the devm cleanup callback > > devm_led_classdev_flash_release() is called. This only happens some time > > after lm3601x_remove() completed. > > I'm sure lots of "use after free" can be fixed by simply removing the > resource freeing... I agree in general. Mutexes are a bit special here and often are not destroyed. mutex_destroy() is a no-op usually and with debugging enabled only does lock->magic = NULL; which catches use-after-destroy. So IMHO just dropping the mutex_destroy is fine. > but lets fix this properly. I don't understand that part. Does that mean you pick up my patch, or that you create a better fix? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |