[PATCH 22/28] mfd: abx500-core: Unregister device ops on devm release
Linus Walleij
linusw at kernel.org
Wed Oct 21 16:42:27 PDT 2026
On Wed, Oct 21, 2026 at 2:16 PM Lee Jones <lee at kernel.org> wrote:
> abx500_register_ops() allocates struct abx500_device_entry via
> devm_kzalloc() and links it into the global abx500_list without
> registering a devres cleanup action. If a caller's probe function
> subsequently fails, devres frees the entry while it remains linked in
> abx500_list, causing use-after-free and list corruption on later
> traversals.
>
> Register a devm_add_action_or_reset() callback in abx500_register_ops()
> to remove the entry from abx500_list before devres frees it.
>
> Fixes: c211b6b9c014 ("mfd: abx500-core: Convert to managed resources for allocating memory")
> Closes: https://sashiko.dev/#/bug/linux-6a9c6b8b-8f89-4af5-8cb1-102822e44e6e
> Cc: stable at vger.kernel.org
> Signed-off-by: Lee Jones <lee at kernel.org>
Reviewed-by: Linus Walleij <linusw at kernel.org>
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list