Re: [PATCH net] devlink: rate: Unset parent pointer in devl_rate_nodes_destroy
From: Jakub Kicinski
Date: Wed Nov 12 2025 - 21:12:49 EST
On Tue, 11 Nov 2025 14:14:39 +0200 Tariq Toukan wrote:
> The function devl_rate_nodes_destroy is documented to "Unset parent for
> all rate objects". However, it was only calling the driver-specific
> `rate_leaf_parent_set` or `rate_node_parent_set` ops and decrementing
> the parent's refcount, without actually setting the
> `devlink_rate->parent` pointer to NULL.
>
> This leaves a dangling pointer in the `devlink_rate` struct, which is
> inconsistent with the behavior of `devlink_nl_rate_parent_node_set`,
> where the parent pointer is correctly cleared.
>
> This patch fixes the issue by explicitly setting `devlink_rate->parent`
> to NULL after notifying the driver, thus fulfilling the function's
> documented behavior for all rate objects.
What is the _real_ issue you're solving here? If the function destroys
all nodes maybe it doesn't matter that the pointer isn't cleared.
--
pw-bot: cr