From: Shay Drori <shayd@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>, Tariq Toukan <tariqt@nvidia.com>
Cc: Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Jiri Pirko <jiri@resnulli.us>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Mark Bloch <mbloch@nvidia.com>,
Gal Pressman <gal@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>,
Cosmin Ratiu <cratiu@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
Carolina Jubran <cjubran@nvidia.com>
Subject: Re: [PATCH net] devlink: rate: Unset parent pointer in devl_rate_nodes_destroy
Date: Thu, 13 Nov 2025 10:33:09 +0200 [thread overview]
Message-ID: <d751e671-9b73-42ce-acce-c98947b632c2@nvidia.com> (raw)
In-Reply-To: <20251112181248.190415f7@kernel.org>
On 13/11/2025 4:12, Jakub Kicinski wrote:
> External email: Use caution opening links or attachments
>
>
> 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
The problem is a leaf which have this node as a parent, now pointing to
invalid memory. When this leaf will be destroyed, in
devl_rate_leaf_destroy, we can get NULL-ptr error, or refcount error.
Is this answer your question?
next prev parent reply other threads:[~2025-11-13 8:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 12:14 [PATCH net] devlink: rate: Unset parent pointer in devl_rate_nodes_destroy Tariq Toukan
2025-11-13 2:12 ` Jakub Kicinski
2025-11-13 8:33 ` Shay Drori [this message]
2025-11-14 1:15 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d751e671-9b73-42ce-acce-c98947b632c2@nvidia.com \
--to=shayd@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jiri@nvidia.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).