Re: [PATCH 2/2] software node: fix primary software node removal
From: Johan Hovold
Date: Mon Nov 02 2026 - 15:04:34 EST
On Mon, Nov 02, 2026 at 12:14:20PM +0100, Johan Hovold wrote:
> When removing a software node using device_remove_software_node(), the
> primary fwnode pointer is never cleared if the software node is the
> primary node.
>
> Since commit 7d80509ff0da ("driver core: platform: unify release path")
> this can lead to a use-after-free when freeing a platform device if a
> driver or subsystem (e.g. mfd) has already removed and freed the node.
>
> Clear the primary fwnode pointer when removing a software node that is
> the primary node to avoid this.
>
> Fixes: 7d80509ff0da ("driver core: platform: unify release path")
> Cc: stable@xxxxxxxxxxxxxxx # 7.3
> Cc: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
Sashiko had some comments on this one, will revisit.
The first patch could go in meanwhile.
Johan