Keeping Track of Resources in the Kernel - Overview and Pitfalls...
summary
Covers concrete kernel helpers and concrete failure modes: devres misuse breaks when resources live outside the bind/unbind window (don’t call devm from subsystem code, don’t manage devices whose lifetime is uncontrolled, don’t hand devres-owned objects to subsystems), DMA remove often needs non-reverse teardown order, and mixing devres with kref objects causes leaks/use-after-free. Shows scope-based cleanup via cleanup.h guards (__attribute__((cleanup))) and scope loops for refcounted objects which simplify cleanup but forbid jump-over/goto patterns and can change break/continue semantics. Modules require try_module_get semantics to pin providers.
AI-written summary · about
