Re: [PATCH] mux: fix use-after-free and node leak in mux_get()

From: Markus Elfring

Date: Wed Apr 08 2026 - 04:15:58 EST



> Fix both issues by moving of_node_put(args.np) after all usage of
> args.np, and introducing a common error label "put_and_ret_err" to
> centralize node release.

I imagine that another label can become helpful also for the statement
“ret = -EINVAL;”.


> Also add missing of_node_put() in all error
> path.

You propose to use such a clean-up action for more cases in the implementation
of the function “mux_get”, don't you?
https://elixir.bootlin.com/linux/v7.0-rc7/source/drivers/mux/core.c#L520-L609

How do you think about to increase the application of scope-based resource management?

Regards,
Markus